如何得到linux下socket返回的错误代码及描述
在linux下用socket编程,对一个远程机器进行连接,如果连接不成功,socket会返回一个错误代码,根据该代码,我们再分析具体的原因,我想知道这些错误代码与他们的描述信息。
如在windows下,用winsock编程时,如果用socket连接一个不存在的ip则会返回60,表示连接超时!
下面使winsocket的返回代码及相应的描述信息:
我想知道linux下对应的信息!
WSAETIMEDOUT 60 10060
Connection timed out. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
WSAECONNREFUSED 61 10061
Connection refused. No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.
WSAELOOP 62 10062
WSAENAMETOOLONG 63 10063
WSAEHOSTDOWN 64 10064
Host is down. A socket operation failed because the destination host was down.
A socket operation encountered a dead host. Networking activity on the local
host has not been initiated. These conditions are more likely to be indicated
by the error WSAETIMEDOUT.
WSAEHOSTUNREACH 65 10065
No route to host. A socket operation was attempted to an unreachable host.
WSAENOTEMPTY 66 10066
WSAEPROCLIM 67 10067
Too many processes.A Windows Sockets implementation may have a limit on the
number of applications that may use it simultaneously. WSAStartup() may fail
with this error if the limit has been reached.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论