Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


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.

↑ Back to the top


Cause

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

↑ Back to the top


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.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


Keywords: kbtshoot, kbwinsock, kbapi, kbnetwork, kbprb, KB140263

↑ Back to the top

Article Info
Article ID : 140263
Revision : 1
Created on : 3/8/1999
Published on : 3/8/1999
Exists online : False
Views : 303