I'm writing a server in C#. The asynchronous example on msdn.microsoft.com suggests the following.
- BeginAccept to listen for client (& start a new thread when client calls).
- BeginReceive to receive the data from client ( & start a new thread to do it on).
- BeginSend to reply to send data to client ( & start yet another thread to it on).
At this point there seems to be 4 separate threads, when from my (possibly naive) point of view there really only needs to be 2. 1 for the server to keep listening on and 1 for the conversation with the client. Why does my conversation with the client need 3 threads since I have to wait for a reply before I send and I won't be doing anything else while waiting to receive data from the client?
Cheers