INFO: WSA_FLAG_OVERLAPPED Needed for Timeout on WSASocket
Article ID: 181610
Article Last Modified on 7/11/2005
APPLIES TO
- Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
- Microsoft Windows 98 Standard Edition
- Microsoft Windows 2000 Standard Edition
This article was previously published under Q181610
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: kbapi kbinfo kbnetwork kbwinsock KB181610