Connection reset by peer
jason at jorendorff.com
Fri Dec 14 11:52:15 EST 2001
> print udpCliSock.getsockname()
> data, addr = udpCliSock.recvfrom(BUFSIZ)
Hmm. It is definitely weird to get ECONNRESET back from a
Well, here's my guess at what's happening.
* Client sends a UDP packet; this gets sent to the server
over the network.
* Server IP layer receives the packet.
* Server IP layer provides a copy of the packet to the server,
since the server is listening on a raw socket.
* Server IP layer then notices that there is no UDP socket
there, on the server, bound to the specified port.
* Server IP layer therefore generates an ICMP "Port Unreachable"
error packet and sends it back to the client.
* Client IP layer receives the error packet and sets a flag on
the udpCliSock saying "hey, you got an error"
* The next time you call udpCliSock.recvfrom(), the error gets
This is just a guess though.
If the guess is correct, then you can make this work by
creating a udpServerSock on the server; you can set it to
nonblocking, occasionally do udpServerSock.recvfrom() on it,
and discard the results.
Jason Orendorff http://www.jorendorff.com/
More information about the Python-list