conditional beginReceive

Posted by sbenderli on Stack Overflow See other posts from Stack Overflow or by sbenderli
Published on 2009-09-14T20:32:26Z Indexed on 2010/05/28 15:01 UTC
Read the original article Hit count: 107

Filed under:
|
|

I am writing a client program that uses Sockets. I would like the client to receive asyncronously UNLESS it is expecting a response, in which case I would like to receive syncronously.

My current problem is that because I have to make a call to socket.BeginReceive which waits until there's data on the buffer, the async call always happens prior to the sync call..

How could I temporarily stop BeginReceive from executing? Is there a way to call EndReceive and then once I am done receiving syncronously, I can continue to receive asnycronously?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sockets