Can't open more than 28234 sockets?

I am writing a network service and I am 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 run this on ubuntu 11.04 and:

 $ ulimit -n 1048576 

How can I overcome this limitation?

+4
source share
2 answers

The usual workaround is to create additional IP addresses on the host, each IP will get an additional ephemeral range of ports according to dan_waterworth's answer if you are connecting a socket to an interface.

Microsoft discusses this topic here:

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

+1
source

The range of ephemeral ports set to:

 /proc/sys/net/ipv4/ip_local_port_range 

Prevents the creation of additional connections.

+1
source

All Articles