当前位置: 技术问答>linux和unix
关于connect返回ETIMEDOUT错误
来源: 互联网 发布时间:2016-03-09
本文导语: 我写了一个并发的TCP服务端,用的是SELECT加上fork子进程的处理方式。 用客户端进行测试时发现,其实FD_SET集最大的情况下也就保存了60多个连接,再加大客户端连接数量的话,客户端connect的时候就会返回ETIM...
我写了一个并发的TCP服务端,用的是SELECT加上fork子进程的处理方式。
用客户端进行测试时发现,其实FD_SET集最大的情况下也就保存了60多个连接,再加大客户端连接数量的话,客户端connect的时候就会返回ETIMEDOUT,解释是这样的“Timeout while attempting connection. The server may be too busy to accept new connections. Note that for IP sockets the timeout may be very long when syncookies are enabled on the server.”
但我现在不知道,服务端是什么问题导致了客户端的连接超时?
请各位大给个优化方案。。。
用客户端进行测试时发现,其实FD_SET集最大的情况下也就保存了60多个连接,再加大客户端连接数量的话,客户端connect的时候就会返回ETIMEDOUT,解释是这样的“Timeout while attempting connection. The server may be too busy to accept new connections. Note that for IP sockets the timeout may be very long when syncookies are enabled on the server.”
但我现在不知道,服务端是什么问题导致了客户端的连接超时?
请各位大给个优化方案。。。
|
listen的问题.
listen(sockfd,backlog);
The second argument to this function specifies the maximum number of connections the kernel should queue for this socket.
排队的最大连接数有限制
listen(sockfd,backlog);
The second argument to this function specifies the maximum number of connections the kernel should queue for this socket.
排队的最大连接数有限制
|
你看是否是达到了server的排队的最大连接个数。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。