开发者

Can't open more than 28234 sockets?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜