BUG: Send() Fails with Error WSAENOBUFS Over Blocking Socket (201213)



The information in this article applies to:

  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Workstation 4.0
  • Microsoft Windows 98
  • Microsoft Windows 95

This article was previously published under Q201213

SYMPTOMS

When large blocks of data (for example, 3-4 MB) are sent over a blocking socket, send eventually fails with error 10055, WSAENOBUFS.

The online documentation indicates that send over a blocking socket should block if there is no system buffer space available:

If no buffer space is available within the transport system to hold the data to be transmitted, send will block unless the socket has been placed in a nonblocking mode. On nonblocking stream oriented sockets, the number of bytes written can be between 1 and the requested length, depending on buffer availability on both client and server machines.

RESOLUTION

When you encounter the problem described in the "Symptoms" section, please consider using one of the following workarounds:
  • Use the socket in nonblocking or asynchronous mode.
  • Break large-size data blocks into small ones and specify a relatively small buffer in send for blocking sockets, preferably no larger than 64K.
  • Set the SO_SNDBUF socket option to 0 (zero) to allow the stack to send from your application buffer directly.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Modification Type:MinorLast Reviewed:12/17/2004
Keywords:kbDSWNET2003Swept kbBug kbWinsock KB201213