Re: Deaf CAsyncSocket on Windows Service.
"Stephen Myers" <StephenMyers@discussions.microsoft.com> wrote in message
Is there any posibility that the data is being received but not triggering
This can happen when two (or more) packets are received without a
call. If you are doing the Receive() in as part of the OnReceive()
make sure there is no data left prior to exiting OnReceive().
On the contrary. Every call to Receive enables the message that will
produce the next call to OnReceive. It is therefore recommended that
Receive should be called only once per OnReceive notification. It is not
true that one must continue to call Receive until it would block.
(Reference: the MSDN page for WSAAsyncSelect - "an application need not read
all available data in response to an FD_READ message ??? a single recv in
response to each FD_READ message is appropriate.")
And, if Receive is called more than once in OnReceive there is a possibility
that another OnReceive notification message (FD_READ) is left in the queue,
and when it is processed later there will be no data.
Suggestion: Call Receive one time only per OnReceive, and make sure the
processing of received data does not permit the message pump to execute
until after you have returned from OnReceive. Both of these steps are
necessary to avoid the possibility of OnReceive and Receive getting out of
Scott McPhillips [VC++ MVP]