Multiple sockets on the same port and multiple sockets on multiple ports

Let me explain my scenario before asking a question.

I'm in the phase of making 17 different multiplayer games that can be played online, right from the browser.
For this I chose Silverlight.
Communication will be done using sockets.

Image 17 different types of games such as Chess, Backgammon, Pool and One Hundred online users interacting between the client application and the server application using Sockets bound to the same PORT number.

Wouldn't it be faster (for my server) if every different game type uses a different PORT number? Chess will use 4502, Backgammon will use 4503, Pool 4504.
Will it matter? Or should I use the same PORT 4502 for all games without fear of something bad happening?

+2


source to share


2 answers


As far as the processing speed on your server is concerned, this will likely make very little difference whether you are receiving all your messages on a single socket or 17. The single socket approach will be slightly faster as your server application will probably have fewer threads for switching between them. However, there will be other things that will have a higher overhead, such as actually handling game movements or authorizing client requests, etc.



As far as the question of whether to use one or more sockets, the biggest thing you should be thinking about is the deployment constraints. The TCP port numbers that Silverlight is allowed to use are non-standard (i.e. not 80 or 443), and if there is a firewall or proxy between your client and server, you might be better off sticking to one port to make the firewall ACL easier.

+2


source


A socket that has been set up as a server can accept connection requests from multiple clients. The original server socket will not become part of the connection. The accept method makes a new socket to participate in the connection and returns that socket. The original server socket remains available to listen for further connection requests.



Thus, it has no advantage to use different server ports. After all the web servers receive all their requests on port 80 and handle it very well.

+3


source







All Articles