Python的socket各种错误号的解释


Python的socket各种错误号的解释
In [1]: import socket
In [2]: print type(socket.errno.errorcode), socket.errno.errorcode
dict {1: 'EPERM', 2: 'ENOENT', 3: 'ESRCH',4: 'EINTR', 5: 'EIO', 6: 'ENXIO', 7: 'E2BIG', 8: 'ENOEXEC', 9: 'EBADF', 10: 'ECHILD', 11: 'EAGAIN', 12: 'ENOMEM', 13: 'EACCES', 14: 'EFAULT', 16: 'EBUSY', 17: 'EEXIST', 18: 'EXDEV', 19: 'ENODEV', 20: 'ENOTDIR', 21: 'EISDIR', 22: 'EINVAL', 23: 'ENFILE', 24: 'EMFILE', 25: 'ENOTTY', 27: 'EFBIG', 28: 'ENOSPC', 29: 'ESPIPE', 30: 'EROFS', 31: 'EMLINK', 32: 'EPIPE', 33: 'EDOM', 34: 'ERANGE', 36: 'EDEADLOCK', 38: 'ENAMETOOLONG', 39: 'ENOLCK', 40: 'ENOSYS', 41: 'ENOTEMPTY', 42: 'EILSEQ', 10000: 'WSABASEERR', 10004: 'WSAEINTR', 10009: 'WSAEBADF', 10013: 'WSAEACCES', 10014: 'WSAEFAULT', 10022: 'WSAEINVAL', 10024: 'WSAEMFILE', 10035: 'WSAEWOULDBLOCK', 10036: 'WSAEINPROGRESS', 10037: 'WSAEALREADY', 10038: 'WSAENOTSOCK', 10039: 'WSAEDESTADDRREQ', 10040: 'WSAEMSGSIZE', 10041: 'WSAEPROTOTYPE', 10042: 'WSAENOPROTOOPT', 10043: 'WSAEPROTONOSUPPORT', 10044: 'WSAESOCKTNOSUPPORT', 10045: 'WSAEOPNOTSUPP', 10046: 'WSAEPFNOSUPPORT', 10047: 'WSAEAFNOSUPPORT', 10048: 'WSAEADDRINUSE', 10049: 'WSAEADDRNOTAVAIL', 10050: 'WSAENETDOWN', 10051: 'WSAENETUNREACH', 10052: 'WSAENETRESET', 10053: 'WSAECONNABORTED', 10054: 'WSAECONNRESET', 10055: 'WSAENOBUFS', 10056: 'WSAEISCONN', 10057: 'WSAENOTCONN', 10058: 'WSAESHUTDOWN', 10059: 'WSAETOOMANYREFS', 10060: 'WSAETIMEDOUT', 10061: 'WSAECONNREFUSED', 10062: 'WSAELOOP', 10063: 'WSAENAMETOOLONG', 10064: 'WSAEHOSTDOWN', 10065: 'WSAEHOSTUNREACH', 10066: 'WSAENOTEMPTY', 10067: 'WSAEPROCLIM', 10068: 'WSAEUSERS', 10069: 'WSAEDQUOT', 10070: 'WSAESTALE', 10071: 'WSAEREMOTE', 10091: 'WSASYSNOTREADY', 10092: 'WSAVERNOTSUPPORTED', 10093: 'WSANOTINITIALISED', 10101: 'WSAEDISCON'}

socket.error: [Errno 10061]解决方法

原因:
在于目标机器没有开启,无法建立socket连接。
解决方法:
开启目标机器。

参考链接
http://filesharingtalk.com/threads/78375-Url-Open-Error-10061-Connection-Refused
https://www.daniweb.com/software-development/python/threads/182033/errno-10061-while-trying-to-send-a-mail-from-script
python socket.create_connectionErrno 10061‘ – AOL Search

In [23]: print socket.errno.errorcode

In [24]: dir(socket.errno)
Out[24]:
['E2BIG',
'EACCES',
'EADDRINUSE',
'EADDRNOTAVAIL',
'EAFNOSUPPORT',
'EAGAIN',
'EALREADY',
'EBADF',
'EBUSY',
'ECHILD',
'ECONNABORTED',
'ECONNREFUSED',
'ECONNRESET',
'EDEADLK',
'EDEADLOCK',
'EDESTADDRREQ',
'EDOM',
'EDQUOT',
'EEXIST',
'EFAULT',
'EFBIG',
'EHOSTDOWN',
'EHOSTUNREACH',
'EILSEQ',
'EINPROGRESS',
'EINTR',
'EINVAL',
'EIO',
'EISCONN',
'EISDIR',
'ELOOP',
'EMFILE',
'EMLINK',
'EMSGSIZE',
'ENAMETOOLONG',
'ENETDOWN',
'ENETRESET',
'ENETUNREACH',
'ENFILE',
'ENOBUFS',
'ENODEV',
'ENOENT',
'ENOEXEC',
'ENOLCK',
'ENOMEM',
'ENOPROTOOPT',
'ENOSPC',
'ENOSYS',
'ENOTCONN',
'ENOTDIR',
'ENOTEMPTY',
'ENOTSOCK',
'ENOTTY',
'ENXIO',
'EOPNOTSUPP',
'EPERM',
'EPFNOSUPPORT',
'EPIPE',
'EPROTONOSUPPORT',
'EPROTOTYPE',
'ERANGE',
'EREMOTE',
'EROFS',
'ESHUTDOWN',
'ESOCKTNOSUPPORT',
'ESPIPE',
'ESRCH',
'ESTALE',
'ETIMEDOUT',
'ETOOMANYREFS',
'EUSERS',
'EWOULDBLOCK',
'EXDEV',
'WSABASEERR',
'WSAEACCES',
'WSAEADDRINUSE',
'WSAEADDRNOTAVAIL',
'WSAEAFNOSUPPORT',
'WSAEALREADY',
'WSAEBADF',
'WSAECONNABORTED',
'WSAECONNREFUSED',
'WSAECONNRESET',
'WSAEDESTADDRREQ',
'WSAEDISCON',
'WSAEDQUOT',
'WSAEFAULT',
'WSAEHOSTDOWN',
'WSAEHOSTUNREACH',
'WSAEINPROGRESS',
'WSAEINTR',
'WSAEINVAL',
'WSAEISCONN',
'WSAELOOP',
'WSAEMFILE',
'WSAEMSGSIZE',
'WSAENAMETOOLONG',
'WSAENETDOWN',
'WSAENETRESET',
'WSAENETUNREACH',
'WSAENOBUFS',
'WSAENOPROTOOPT',
'WSAENOTCONN',
'WSAENOTEMPTY',
'WSAENOTSOCK',
'WSAEOPNOTSUPP',
'WSAEPFNOSUPPORT',
'WSAEPROCLIM',
'WSAEPROTONOSUPPORT',
'WSAEPROTOTYPE',
'WSAEREMOTE',
'WSAESHUTDOWN',
'WSAESOCKTNOSUPPORT',
'WSAESTALE',
'WSAETIMEDOUT',
'WSAETOOMANYREFS',
'WSAEUSERS',
'WSAEWOULDBLOCK',
'WSANOTINITIALISED',
'WSASYSNOTREADY',
'WSAVERNOTSUPPORTED',
'__doc__',
'__name__',
'__package__',
'errorcode']

 

,

《 “Python的socket各种错误号的解释” 》 有 2 条评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注