[Tutor] Socket Error Handling Syntax
eryksun
eryksun at gmail.com
Wed May 29 02:53:29 CEST 2013
On Tue, May 28, 2013 at 3:49 PM, Dave Angel <davea at davea.name> wrote:
> I don't use Windows, but I doubt if there's a separate exception
> type for 10057.
Windows sockets error codes at or above 10000 aren't mapped to POSIX
error codes. Instead errno is set directly from winerror. So there's
no reason to look at winerror in this case.
Use the errno module:
Windows:
>>> errno.errorcode[10057] # Windows-specific name
'WSAENOTCONN'
>>> errno.ENOTCONN
10057
Linux:
>>> errno.ENOTCONN
107
>From MSDN, Windows Socket Error Codes:
WSAENOTCONN 10057
Socket is not connected.
A request to send or receive data was disallowed because the socket is
not connected and (when sending on a datagram socket using sendto) no
address was supplied. Any other type of operation might also return
this error—for example, setsockopt setting SO_KEEPALIVE if the
connection has been reset.
http://msdn.microsoft.com/en-us/library/ms740668
More information about the Tutor
mailing list