[SOLVED] Connecting to Remote J-Link via IP not resolving

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Connecting to Remote J-Link via IP not resolving

    Hi there,

    I have been using a J-Link running v6.50b. My development environment is inside a linux Docker container, and the Host OS is Windows 10. I run the J-Link remote server on the host with the J-Link connected via USB and connect from inside the container using JLinkeExe -ip host.docker.internal which has been working fine. Recently I upgraded the segger tools to version 6.98c and it has stopped working.

    My docker container still resolves the address using ping

    Source Code

    1. ping host.docker.internal
    2. PING host.docker.internal (192.168.65.2) 56(84) bytes of data.
    3. 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=1 ttl=37 time=1.15 ms
    4. 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=2 ttl=37 time=1.48 ms
    5. 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=3 ttl=37 time=1.19 ms


    And can connect using the hard coded address

    Source Code

    1. JLinkExe -NoGui 1 -ip 192.168.65.2
    2. SEGGER J-Link Commander V6.98c (Compiled Mar 16 2021 12:23:05)
    3. DLL version V6.98c, compiled Mar 16 2021 12:22:49
    4. Connecting to J-Link via IP...JLinkGUIServerExe: cannot connect to X server
    5. O.K.
    But does not connect using the host.docker.internal name anymore

    Source Code

    1. JLinkExe -NoGui 1 -ip host.docker.internal:19020
    2. SEGGER J-Link Commander V6.98c (Compiled Mar 16 2021 12:23:05)
    3. DLL version V6.98c, compiled Mar 16 2021 12:22:49
    4. Connecting to J-Link via IP...FAILED: Cannot connect to J-Link name host.docker.internal via TCP/IP. No emulators found.
    5. Cannot connect to J-Link.
    What I notice is that the error is

    Source Code

    1. Cannot connect to J-Link name host.docker.internal via TCP/IP
    But if I type a wrong IP it gives

    Source Code

    1. JLinkExe -NoGui 1 -ip 192.168.65.3
    2. SEGGER J-Link Commander V6.98c (Compiled Mar 16 2021 12:23:05)
    3. DLL version V6.98c, compiled Mar 16 2021 12:22:49
    4. Connecting to J-Link via IP...FAILED: Can not connect to J-Link via TCP/IP (192.168.65.3, port 19020)
    5. Cannot connect to J-Link.
    6. J-Link>
    Almost like it is treating the host.docker.internal as the name of a J-Link even though it is passed in with the -ip.


    Can anyone shed some light on this and how I can fix?

    Thanks
    Travis
  • Hi,

    You are confusing J-Link name with hostname here.
    The -ip <Name> command was never meant to resolve hostnames but was meant to resolve J-Link nick names to an actual IP.
    J-Links can be discovered via a special UDP broadcast packet in LAN (This is what J-Link Configurator does to find and list them).
    The response also contains the nickname of the J-Link.

    The hostname of your machine / VM / docker container etc. is something completely different.
    IP connections made by J-Link utilities are not aware of any hostname.
    If it was working in the past, it was a bug. (Probably a bug that the name was taken as a hostname instead of a J-Link nickname, so nicknames did not work but were documented to be working).

    Connecting to a J-Link Remote Server instance is not different for any J-Link utility. It is handled the same as a IP J-Link (like J-Link PRO).
    The difference on the low-level is that Remote Server is currently not discoverable via the special UDP broadcast packet, so -ip <Nickname> won't work for Remote Server connections, only -ip <IP> does.

    Short:
    This is no regression, as it was never meant to work.
    You may run a tool to do hostname resolving before starting J-Link Commander and pass the actual IP to it.