|
-
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.
-
May 19th, 2009, 04:25 AM
#2
Thread Starter
Hyperactive Member
Re: Large amount of simultaneous clients
Upon trying to implement this using .ReceiveTimeout on a socket.. The first call times out after 3 seconds and throws
Code:
A connection attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because connected host
has failed to respond
That's fine, however each subsequent call immediately returns
Code:
A non-blocking socket operation could not be completed immediately
even though the socket has .Blocking set to true. So again, anyone with a possible work around to this would be of great help as I can't seem to find a solution for this.
» 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.
-
May 28th, 2009, 08:01 AM
#3
Thread Starter
Hyperactive Member
Re: Large amount of simultaneous clients
Bumpety Bump Bump... Surely somebody has done something like this before........ c'mon
» 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
|