Microsoft KB Archive/181610

From BetaArchive Wiki

INFO: WSA_FLAG_OVERLAPPED Needed for Timeout on WSASocket

Q181610



The information in this article applies to:


  • Microsoft Win32 Software Development Kit (SDK), used with:
    • the operating system: Microsoft Windows NT
    • Microsoft Windows 95
    • Microsoft Windows 98
    • the operating system: Microsoft Windows 2000





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.

Additional query words:

Keywords : kbnetwork kbAPI kbOSWinNT400 kbOSWin2000 kbSDKPlatform kbOSWin95 kbOSWin98 kbWinsock kbGrpDSNet
Issue type : kbinfo
Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch


Last Reviewed: December 17, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.