Crash when ofxTCPClient tries to connect to an IP that doesn't exist?

Help! How can I stop my application crashing when ofxTCPClient tries to connect to an IP that doesn’t exist?

I have multiple instances of ofxTCPClient connecting to my other machines, but if I set one instance to an IP that cant be found it freezes up. I think that must be the cause, since it will work fine if I set it to an IP on the network even if that machine isn’t running the server.

Im running OSX.

Any advice would be greatly appreciated.

I had this problem before as well, check this thread for a solution-

Great thanks for the solution.

Also is it possible to change the timeout setting? so that original ofxTCPClient doesn’t hang for the 70 - 90 odd seconds? say 5 instead would be acceptable in my application.

There isn’t an OF friendly way to do it, but it is possible. You will have to edit the Connect() method in ofxTCPManager.cpp. You need to set the socket connection to non blocking, create a timeout, and use a select() to check if the socket is ok. There is an example on stackoverflow by caf that will do exactly this-

If you need help implementing let me know.