Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to establish many(the more - the merrier) socket connections on Windows 2003 server.
I make several server sockets and connect to them from current computer (1 server socket serves 1 client). I also make 1 server socket which serves many connections from another local computer.
When I make 4000 server sockets and 4000 connections to them, plus 4000 client connections to one server socket - everything works fine.
When I try the same thing with 5000 (5000 server sockets and 5000 connections to them) and start connecting clients remote, 1779th client and all the following (1780th, 1781th...) throw exception that connection has been reset or refused.

I have 8Gb RAM, MaxUserPort in registery set to 65534 and it didn't help. I've also tried to set MaxFreeTcbs to 12000 (not sure if it's necessary). Where else could be the problem?

share|improve this question
What I/O model are you using? IOCP? Completion routines? By 5,000 server sockets, do you mean 5,000 calls to listen? Or do you mean 5,000 accepts? (And are you 100% sure the client isn't the limiting factor?) – David Schwartz May 2 '12 at 9:51
32 bit or 64 bit? 32 bit is limited. 8gb ram is quite low for a server allocating 10 thousand buffers for tcp conncetions, potentialy.Your threading model may suck out the rest of the memory, depending how you program it (completion ports a necessity). – TomTom May 2 '12 at 10:03
I use IOCP. 5000 server sockets = 5000 listen. 32 bit. no, it's not client. I guess it's memory issue, but not sure. If I try to do the same with 6000, I can't even create so many server sockets. But task manager shows low memory usage... – Natalia May 2 '12 at 10:31
What goes wrong when you try to create 6,000 server sockets? What function fails (socket? bind? listen?) And what error do you get? Also, is there some specific reason you are using so many listening sockets? – David Schwartz May 2 '12 at 11:09
The error is "no buffer space available". Fails listen. Yes, I do need so many server sockets because it's an interface, which I should provide to foreign application. – Natalia May 2 '12 at 11:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.