I have a C# Socket configured for streaming TCP. Upon making a valid
connection, I have an asynchronous callback configured using
BeginReceive. Within the BeginReceive declaration, I set the socket
flags to SocketFlags.Partial to allow my callback to be invoked as
soon as it arrives rather than waiting for the receive buffer to fill
up.
The problem I am having is that when I invoke the
Socket.EndReceive(asyncResult) operation within the callback, it
sometimes returns a value less than what is stored in the receive
buffer. For example, the receive buffer of 2048 bytes has 76 bytes of
real data in the buffer. However, the Socket.EndReceive operation
returned 74 when it was invoked.
Is this a known bug with .NET 2.0? Or am I doing something wrong
syntactically?