Help and Support

Article ID: 140263 - Last Review: March 8, 1999 - Revision: 1.0

PRB: recv() w/MSG_PEEK Always Returns Wrong Buffer Size

This article was previously published under Q140263
Expand all | Collapse all

SYMPTOMS

An Application that uses the Winsock 1.1 call recv(..., MSG_PEEK) repeatedly, will always receive the amount of data as in the first call. This amount only changes when you call recv without MSG_PEEK.

CAUSE

This is the result of a performance optimization within AFD.SYS.

RESOLUTION

recv() with MSG_PEEK should generally be avoided. It is a very inefficient way to retrieve data and definitely not recommended if you care about performance. A much better solution would be to simply receive the data into user buffers and use it directly from there.

STATUS

This behavior is by design.

APPLIES TO
  • Microsoft Win32 Software Development Kit (SDK) 3.51
Keywords: 
kbtshoot kbwinsock kbapi kbnetwork kbprb KB140263

Article Translations