UDP can trigger on UDPREAD, UDPWRITE, and SOCKCLOSE events, so you would need to check all of those events in case Winsock reports an error. Apart from that, I cannot see anything in the source code that would cause a socket to be closed quietly in the background without triggering a script event. Perhaps adding more debugging might help narrow it down, such as checking if a socket still exists after a /sockread?