I play with Python and listen to UDP packets on this port, everything seems to work beautifully - but after a long period of time, the script crashes with the following error:
data = self._sock.recv(self._rbufsize)
socket.error: [Errno 54] Connection reset by peer
When you restart only the script, the same crash occurs again after a shorter period of time. Restarting the server instead seems to completely resolve the issue for a while.
As for the socket side, I do:
UDP_IP = "0.0.0.0"
UDP_PORT = 6000
sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind( (UDP_IP, UDP_PORT) )
Am I missing something obvious or is there an easy way to avoid this?
Thanks in advance for any light you can throw off!
Benji
source
share