TCP/IP Ioctlsocket Function Returns Incorrect Data

Last reviewed: September 9, 1996
Article ID: Q125486
The information in this article applies to:
  • Microsoft TCP/IP-32 for Windows for Workgroups, version 3.11a
  • Microsoft Windows for Workgroups version 3.11

SYMPTOMS

A call to ioctlsocket() with a command of FIONREAD should return the amount of data currently in the receive buffer on a specific socket. If a recv() is then posted to the same socket, the recv() should complete successfully and return with the specified number of bytes of data.

If a second ioctlsocket() call is issued to the same socket after a recv() completes, the number of bytes returned should be the bytes in the receive buffer before the recv() minus the bytes read by the recv() (assuming no additional data came in over the network).

The problem described here is that number of bytes in the receive buffer returned from the ioctlsocket() call is not updated after a recv() is issued.

The following sample debug log illustrates this problem:

   Got an FD_READ
   Disabling FD_READ
   FIONREAD bytes = 239.
   Bytes read = 100.
   ioctl for  FIONREAD returned 239.
   Bytes read = 100.
   ioctl for  FIONREAD returned 239.
   Bytes read = 39.
   ioctl for  FIONREAD returned 0.
   Enabling FD_READ
   WM_DESTROY
   Closing DebugFile

STATUS

Microsoft has confirmed this to be a problem in Microsoft TCP/IP-32 for Windows for Workgroups, version 3.11a. This problem was corrected in Microsoft TCP/IP-32 for Windows for Workgroups, version 3.11b.


KBCategory: kbnetwork kbbug3.11a
KBSubcategory: nttcp
Additional reference words: wfw wfwg 3.11 3.11a prodtcp32



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 9, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.