pravin gate wrote:Thanks, for showing interest .
If the queue depth for incoming connection requests default value is 50, does It means that I can handle my port say '5000' can handle only 50 requests at a time.
No. For one thing, the port doesn't handle requests. The port is just an identifier that indicates where the request should go.
For another, what it means the
ServerSocket can handle 50 simultaneous requests for a new connection at once. (Or maybe 51--50 backlog + 1 currently being processed.) But don't worry. Unless either a) you're google.com or b) your code that handles the connection request is poorly written, you won't have that many connection requests backing up.
Also, note that this is the number of requests to establish a connection. Logging in, just like chatting, is something that's done after the connection is established. If you have 50 people trying to log in, or 50 people chatting, then they've already got their 50 connections, and that means 50 different sockets.
At this point, handling simultaneous network traffic can be divided into two parts:
1) Data on the wire being delivered to your
Java app. This is not a Java question. This is about your hardware, how your OS is configured, and your routers and switches and ISP and a whole slew of stuff that's generally out of your hands and definitely out of scope for any discussion here.
2) Data that your Sockets are receiving that you need to process, presumably in multiple threads. This is the part that you have some control over, and this is where
you should focus your attention.
However, when all is said and done, I think you should lay this question aside for the moment. It's good to be curious about it, but if you're just starting out in Java network programming, then "maximum simultaneous requests" is not going to be a practical concern for you, and certainly not at the socket level. So focus on proper design, and on understanding multithreading and the basics of Java network programming, and revisit this question when you want to study networking in general as its own topic.