Question

I have coded a server in Java that will have several clients connected to it. I want to be able to see how much data is sent to each client to be able to make decisions like allowing more clients or decreasing them, or even to increase/decrease the frequency at which the data is sent. How can I do that?

I'm currently using Java's Socket API, but if any other library gives me this easily, then a change can be done. The server will run in a linux flavor, likely Ubuntu, so a OS specific answer is welcomed too.

Was it helpful?

Solution

When you write data to the socket, you need to remember how much you sent. There really isn't smarter way to do this.

Generally speaking, you would allow the server to have a limited number of connections. Trying to tune the system based on bandwidth restrictions is very hard to get right.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top