oscSender connect() always returns true

Dear All,

I don’t know if I’m overlooking something obvious but I think there is a bug with the oscSender.

Using the connect() message, the documentation says it returns true if a connection is made and false otherwise.

But when I try it out and it always returns true.
Even If I’m removing the other device from the network, it just returns true all the time.

jure::String testIP = ""

if(connect(testIP, 8090))
  DBG("This always prints")

The device is clearly out of the network, if I try to ping it from the terminal I get 100% timeouts:

PING ( 56 data bytes

Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
ping: sendto: No route to host
Request timeout for icmp_seq 4
ping: sendto: Host is down
Request timeout for icmp_seq 5

— ping statistics —

7 packets transmitted, 0 packets received, 100.0% packet loss

Someone has an idea what I’m maybe overlooking?

Thanks in advance!

Perhaps the docs are a bit misleading here. As far as I can etll, the sender doesn’t really establish a “connection”. It opens a socket and then attempts to send messages to the specified address, but without checking that the messages are received. If you want to check that the destination machine is online, you’ll need to use a different technique. You may find the NetworkServiceDiscovery class helpful as a starting point.

1 Like

Yeah looking at the Code it makes sense, it returns true when the socket parts work,
so like you said, if I want to check if the other device is really online and connected I need another approach.

Thank you very much for the quick reply!