INFO: INFO:WSA_FLAG_OVERLAPPED Needed for Timeout on WSASocket

Last reviewed: March 2, 1998
Article ID: Q181610
The information in this article applies to:

- Microsoft Win32 Software Development Kit (SDK) on the following

  platforms:
   - Windows NT, version 4.0
   - Windows 95

SUMMARY

If you create a socket using the Winsock 2 WSASocket API and you need to apply a timeout in receive or send operations on the socket, you must specify the WSA_FLAG_OVERLAPPED flag in the WSASocket call.

MORE INFORMATION

If a socket is created without the overlapped I/O attribute, all I/O operations on the socket are synchronous. So if your program has set socket options SO_SNDTIMEO and SO_RCVTIMEO, you need to make sure your socket is created with the overlapped I/O attribute to timeout your blocking send or receive operations.

The overlapped I/O attribute of a socket created via the socket API is set internally. If you use WSASocket API, you need to set the WSA_FLAG_OVERLAPPED flag yourself in the last parameter of this API call.

Keywords          : NtwkWinsock
Version           : WINNT:4.0;Win95
Platform          : Win95 winnt
Issue type        : kbinfo


================================================================================


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: March 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.