为什么在1024个连接后连接被拒绝? [英] Why do I get connection refused after 1024 connections?

查看:173
本文介绍了为什么在1024个连接后连接被拒绝?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在服务器和客户机都位于同一服务器上的本地Linux服务器上进行测试.在大约1024个连接之后,在我的代码中(我连接的地方),连接被拒绝.起初,我认为select的fd_set_max限制为1024,并将服务器更改为轮询而不是select进行轮询,但我仍然没有超过这个数字.我的ulimit -n设置为2048,我监视服务器上的lsof,它达到大约1033(不确定这是否是确切的数字)并且失败.非常感谢您的帮助.

I am testing on a local Linux server with both the server and client in the same server. After about 1024 connections, in my code, where I connect, I get connection refused. At first I thought it was the fd_set_max limit of 1024 for select and changed the server to do poll instead of select and I still don't get past this number. My ulimit -n is set to 2048 and I monitor the lsof on the server it reaches about 1033 (not sure if this is exact number) and fails. Any help is much appreciated.

推荐答案

因此,经过更多研究..看来我的服务器端侦听的队列深度为20.我认为这就是原因.你们中有人也认为这是问题所在吗?

So, after a little more research.. it looks like my server side listen is having a queue depth of 20. I am thinking thats the reason. Do any of you guys think thats the problem too?

致谢

这篇关于为什么在1024个连接后连接被拒绝?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆