Doing searches through the forums seem to show that trying to use threads and sockets seem to be fraught with problems, but we seem to have a new problem which has only occurred recently with newer Xojo versions.
We have a socket.connect command inside a thread. The port and address is set just before the connect is called.
If socket.connect is called on a PC, everything works.
If socket.connect is called on a Mac and connect to another mac, everything works.
if socket.connect is called on a Mac and connects to a remote(via internet) PC, everything works,
Now things get weird.
if socket.connect is called on a Mac and connects to a local(VM) PC we get a socket error 22 immediately on the connect.
If I pause(in the IDE) on the socket.connect line, then press continue, everything works, every time.
If we add a app.doevents(100) before socket.connect everything seems to work.
It appears that there takes an undetermined amount of time to create the socket, which causes a problem on Mac. The error 22 is immediately returned after socket.connect. If I add a breakpoint on the line after socket.connect, the error occurs before that line is reached.
We’ve used this connection type for years, but it’s only recently that we have a problem. We’re not too bothered about dataavailable being run on the main thread, but it would be good to have the connect run on a thread so that the UI is not locked during the connection process.