开发者

Can't open more than 28234 sockets?

开发者 https://www.devze.com 2023-03-10 07:24 出处:网络
I\'m writing a network service and I\'m aiming for high concurrency. For some reason, when I try to connect to the 28,234th socket I get:

I'm writing a network service and I'm aiming for high concurrency. For some reason, when I try to connect to the 28,234th socket I get:

[Errno 99] Cannot assign requested address
开发者_运维问答

The client is written in python and the server side is written in haskell. I'm running this on ubuntu 11.04, and:

$ ulimit -n
1048576

How can I overcome this limitation?


The usual workaround is to create additional IP addresses on the host, each IP will gain you an additional ephemeral port range as per dan_waterworth's answer as long as you bind the socket to the interface.

Microsoft have a discussion on the topic here:

http://msdn.microsoft.com/en-us/library/cc150670(v=vs.85).aspx


The ephemeral port range set in:

/proc/sys/net/ipv4/ip_local_port_range

Prevents you from creating more connections.

0

精彩评论

暂无评论...
验证码 换一张
取 消