UDPSocket Error 54 ?

Hi there

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

I found this in the windows error list:

ERROR_NETWORK_BUSY
54 (0x36)
The network is busy.

Interesting…
Based on what I’m reading online this means there is a bottleneck in the TCP/IP Layer.

I can’t believe my app is overloading the socket as the datagrams are quite small (100bytes max) and the PacketsLeftToSend variable is usually 0 when the socket breaks. I modified my code slightly to record the number of packets written to the socket inbetween each time I have to reset it, I was expecting it to be a constant high value but instead it was anywhere between 6 and 145 packets??

This really is bizzarre

Ok
So I appear to have fixed the issue at least for now. Looks like the culprit might be Kaspersky Internet Security. Once disabled I don’t get the errors anymore, which suggests it must be doing something at the TCP/IP layer which causes problems with the app