That sounds right in practice on the simulator you’ll get 127.0.0.1 which is the default network loopback. When you install it on a UR and run the same line of code you’ll get your ‘192.168.0.10’ or whatever your network settings are setup too. Since the simulator (linux virtual machine) doesn’t work for UR’s network, I have been running an app called ‘SocketTest’ and I start a server at ‘127.0.0.1’ so I can see my URCap connect to this server and display messages/send messages.
Your code is the same that I used this morning and tested out.
Have you tried using NetworkInterface.getNetworkInterfaces() as this should return all the network interfaces and then you can just iterate over, there should only be two with the robot, localHost and the ipV4 address. Local Host will always start with 127 so you just ignore that one and use the other one.
@mbush:
tried this approach but skiped it seeing the number of IPs on ursim. Just now I took a closer look => you are right there are “only” 2 ip4 addresses.
Reading some more about this topic I would list the available addresses in urcap settings so the user can select the correct one.
Preselected IP: the approach of @mbush - provided that ip4 count > 1
Then you are prepared for warning/error -handling.
edit:
Polyscope should know about user input => could be a feature request