|
-
May 23rd, 2012, 11:01 AM
#1
Thread Starter
Addicted Member
Networkstream.read/.beginread ,threads and things?
In my own little world were I write small server/client applications, I might only have 5 to 10 clients. I usually create a new thread which handles reading the networkstream or use networkstream.beginread (which I understand basically does the same thing). When the client disconnects or the connection is lost then the thread ends.
Now in the real world the number of clients connected to a server could be hundreds. I dont think my pc could cope with hundreds of threads
So to finally get to the questions, how does the real world handle gettting data from a large quantity of network clients.
I thought about creating a thread to loop through a list of clients and checking to see if data was available. If so creating a thread to read data from that networkstream untill all data was read. once all data was read the thread would end.
Or am I barking mad and up the wrong tree?
-
May 24th, 2012, 11:35 AM
#2
Thread Starter
Addicted Member
Re: Networkstream.read/.beginread ,threads and things?
I see I have lots of views of my question but no responses.
Maybe my question is to vague or is it in the wrong category?
If so, to clairfy the question. How do I handle reading data from large quantities of client connections without using large quantities of threads?
-
May 25th, 2012, 08:11 PM
#3
New Member
Re: Networkstream.read/.beginread ,threads and things?
almost same as small number of clients, handle data connections well and use resources in good way :-)
good systems will do the work if they based on correct business rules ...
-
May 29th, 2012, 12:53 PM
#4
Thread Starter
Addicted Member
Re: Networkstream.read/.beginread ,threads and things?
Thanks freedomkw for the reply.
Thats what Im trying to do.
I have implemented my idea of keeping a list of connected clients then using a thread to loop through the list checking if data is available then creating a thread to do the actual read. Its a bit more complicated than that, but generally that is how it works. The thread dies once the data is read.
It seems to keep thread allocation at a reasonable level.
Some ideas/concepts/suggestions would be appreciated as to how it is done in the real world.
-
May 31st, 2012, 09:23 PM
#5
New Member
Re: Networkstream.read/.beginread ,threads and things?
You welcome :-)
There no special rules or ways to do applications for real world .. always keep your application simple & stable also keep in mind that Software design is a process of problem solving ...
as for ideas, please send me email with details and application you doing and will try to help you
Delivering the exact results at the moment of interest is no coincidence. It's magic!
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
|