|
-
May 18th, 2009, 07:38 AM
#1
Thread Starter
Hyperactive Member
Large amount of simultaneous clients
Hello
I work with alot of network applications, however there is generally only ~300 clients connected to a TCP connection at any one time.
Due to the low amount of clients, each one has it's own thread that is constantly receiving messages from the client (as data needs to be instantly received once sent). On a larger scale however, I do not believe that spawning a thread for every single client is the way to go.
I've read around other sites and articles on how to handle a situation such as this but they suggest using Asynchronous methods... Which will (I assume) simply spawn threads in the background to do the receiving, which again is not what I want.
My initial idea to handle this would be to spawn one thread per 5 clients, and have them it call a receive method that would time out after 1-3 seconds of not receiving any data, and move on to the next client in a loop. That would, I believe, work perfectly fine, and solve any problems that we may have. Of course not counting the thread dying and we lose 5 clients due to a possible error with a single client, that's not too much of an issue.
The only downside is that I haven't found a single method that allows a timeout to be set for the receive method.
Has anyone faced a similar problem and come to a resolution, or know of a method that will allow a timeout to be set on a receive?
Thanks in advance.
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|