Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Maximu number of TCP connections


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Xanather   Members   -  Reputation: 712

Like
0Likes
Like

Posted 27 July 2012 - 08:40 AM

Simple question: I remember hearing somethere that when one machine exceeds a "number" of simutanious TCP connections all sorts of problems occur. I am asking this question specifically about .net's sockets (which are pretty much wrappers for winsock).

Replies are appriciated. Thanks :D

Sponsor:

#2 samoth   Crossbones+   -  Reputation: 4936

Like
3Likes
Like

Posted 27 July 2012 - 08:57 AM

Generally, no such thing as "all kinds of problems occur" is happening.

You can have a maximum of 65536 TCP connections with each other machine that has a distinct IP address (or a total of 65536 connections with a group of machines behind NAT) because the port number is 16 bits and a connection is identified by address and port. It is very unlikely that you will ever run into this limit.

Some operating systems impose per-process and per-user quotas on how many descriptors you can create. Again, you're rather unlikely to run into trouble with this limit.

The only real difficulty with having many ("many" as in 5,000 or 10,000) connections is how to actually handle them, that is how to schedule sending and receiving your data so nobody is unfairly stalled and you don't spend excessive work figuring out which socket has data, and which socket is ready to send, etc.
Since you said .NET and Winsock, you will most likely be interested in looking into completion ports for that matter. Handling 10k connections is no challenge for a completion port.

#3 Xanather   Members   -  Reputation: 712

Like
0Likes
Like

Posted 27 July 2012 - 09:48 AM

Ok thanks!

#4 BitMaster   Crossbones+   -  Reputation: 4274

Like
0Likes
Like

Posted 01 August 2012 - 05:39 AM

You can have a maximum of 65536 TCP connections with each other machine that has a distinct IP address (or a total of 65536 connections with a group of machines behind NAT) because the port number is 16 bits and a connection is identified by address and port. It is very unlikely that you will ever run into this limit.


Actually, that is not completely correct. A connection is identified by the complete tuple (local ip, local port, remote ip, remote port), so you could have (theoretically) many more distinct connections between two machines or machines behind a NAT.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS