M
Markus Ewald
Hi!
Using the System.Net.Sockets.Socket class, how am I supposed to wait for
incoming data?
If, for example, I've got a large number of connections that all need to
be monitored for incoming data, do I have to call BeginReceive() for
each socket (possibly producing 50 background threads assuming a naive
socket implementation) and then spawn another 50 threads myself for
blocking on the EndReceive() methods of all the sockets?
Back in C++ I had a shared monitoring thread which blocked by calling
WaitForMultipleObjects() on an array of all the sockets.
I think I could reimplement this concept in .NET using the WaitHandles
provided by the AsyncResult class that is returned from
Socket.BeginReceive(). Is that the way to go?
Thanks,
-Markus-
Using the System.Net.Sockets.Socket class, how am I supposed to wait for
incoming data?
If, for example, I've got a large number of connections that all need to
be monitored for incoming data, do I have to call BeginReceive() for
each socket (possibly producing 50 background threads assuming a naive
socket implementation) and then spawn another 50 threads myself for
blocking on the EndReceive() methods of all the sockets?
Back in C++ I had a shared monitoring thread which blocked by calling
WaitForMultipleObjects() on an array of all the sockets.
I think I could reimplement this concept in .NET using the WaitHandles
provided by the AsyncResult class that is returned from
Socket.BeginReceive(). Is that the way to go?
Thanks,
-Markus-