4

I have been working on a project regarding TCP/IP socket connection and message transferring through these sockets. I am connecting to a UNIX server with a specific IP address and establishing socket connections. So far I could manage roughly 16000 connections from 1 host (in this case this is my own pc). And when I try establishing other connections from other hosts (either it is Mac Osx or Windows PC), I reached the same maximum connection number, 16000.

I can have 65536 connections on server side and I literally maintained that. But only when it is 16000 connections in each of 4 different computers. I wonder why I have this and how I can establish more than 16000 connections from only 1 host.

2
  • 2
    Are you sure you're limited to 65536 connections on the server side? I realise that you say you have a Unix server, but Windows tracks inbound connections using a tuple that consists of local address, local port, remote address, remote port. So you can have far more than the 65536... Commented Sep 11, 2013 at 12:51
  • Actually I set ulimit to 128000 even though I don't need it. But that's not the issue. I want to establish more than 16000 connections from 1 host. Commented Sep 11, 2013 at 15:09

1 Answer 1

4

On Windows systems the TCP stack is subject to several registry parameters. They're arcane and poorly documented, and had changed with newer (Vista, Win7, Win8) releases, they also vary between desktop OS and server OS flavors.

Some KBs and MSDN articles cover the subject:

But this article is more to the point for your problem: Avoiding TCP/IP Port Exhaustion. Although is BizTalk related, the topic and solution are generic: increase MaxUserPort and decrease TcpTimedWaitDelay (careful with the later one though). The specifics your system ends up supporting vary, so you have to play with the settings. Make sure your test machines are 64 bit processor, 64 bit OS, and have enough of RAM (>4Gb).

For OS X I hope somebody else will provide the details.

Sign up to request clarification or add additional context in comments.

1 Comment

Usually all you need to do is make sure that MaxUserPort is at maximum and that you're not running too much other stuff that is using up ports in the ephemeral range. I'd be very wary of reducing TIME_WAIT delay, it exists for a reason and you often end up chasing the delay lower and lower; see serverframework.com/asynchronousevents/2011/01/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.