Game Development Stack Exchange is a question and answer site for professional and independent game developers. 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

There are a few older games (Quake III and Hexen II to name a couple) where the server assigns a port per player.

Are there performance advantages to this? I suspect there may be, since Carmack & Co.'s endeavours tend to lean in that direction.

I found this, which doesn't provide many different points of view... unfortunately the Book of Hook (link therein) has been down of late, and I don't know if it will ever become available again. What a waste of valuable oldschool knowledge. (If anyone knows where else this might be available, I would be indebted.)

share|improve this question
up vote 4 down vote accepted

Depending upon your requirements I can imagine following advantages:

  1. Independent buffer size for every port for incoming packets. As long as new packets come in and await the processing you are sure you won't face any massive packet loss if your buffer is full. Usually losses of 2-3 packets are not crucial, TCP will quickly have them resent and UDP-based protocols are usually tolerant to losses. If you have a single buffer than you are at risk that somebody will just "DDOS" your complete queue with packets leading to server overload and malfunction.
  2. Having different ports you can easily prioritize certain users: if somebody has 10 ms ping and another 170 it is clear that the first user might require responses much more often. You can also add some type of membership -- gold member can get more packets and hence a better reactive game etc.
  3. In case of cheating or hacking it is easier to track back the user if every user has a single port assigned to it. Else you have to look at every packet payload, that might be not as easy (especially if the information is encrypted).
share|improve this answer
Thanks Alexander, this is really helpful. Are you certain about the buffers? I'm surprised no-one on said anything about this. Very good point on the accountability front. – Arcane Engineer Dec 13 '11 at 19:50
This is a common topic in optimizing network performance: the size of TCP buffer. This is normally constant per TCP socket, but many OS can increase or decrease it depending upon the transmission load. It is just easier to manage those buffers if you have different ports, for if it is the same port you have no a priori information about the socket to be opened (except for IP that might change). – Alexander Galkin Dec 13 '11 at 19:52
Thanks Alex. Without seeing any particular downsides to one-socket-per-client, I've gone this route. Increased separation is usually a good thing, even beyond the points you've made above. – Arcane Engineer Dec 15 '11 at 17:13

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.