Have run into a problem that’s getting on my nerves and I can’t seem to be able to track down what’s causing it so hope someone might be able to shed some light.
I have a segment of code that runs in a timer with a low period that polls a UDPSocket and Reads and Writes data to acheive as fast a communication as possible, however I’m finding that after every few seconds the socket is disconnecting from the port with Error Code 54. I should point out this is on Windows and I’ve had no luck finding out exactly what this error code is as most of the Windows OS Socket Error codes are in the 10000 range.
Following this error, the “IsConnected” property is False the next call to udpsocket.Write gives an “Invalid State Error” which is what you would expect if it was now unbound from the port. However, if I try and call Connect to rebind the socket I get an “Address already in use error”! It’s as if the socket still thinks the port is in use when it isn’t.
So far the only way I’ve found around this is to check the IsConnected property after every read or write and to call Disconnect and then Connect again which successfully rebinds the socket to the port until it happens again.
Does anyone know what error code 54 is? Is this some weird bug of Xojo? Everything I’ve tried to fix this so far has failed
p.s. Using Xojo 2016r3