Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Introducing overlapped I/O requires a mechanism for applications to unambiguously associate send and receive requests with their subsequent completion indications. In Winsock, this is accomplished with event objects that are modeled after Win32 events. Windows Sockets event objects are simple constructs that can be created and closed, set and cleared, and waited on and polled. Their prime use is to provide the ability to an application to block and wait until one or more event objects become set.

Applications use WSACreateEventto obtain an event object handle that can then be supplied as a required parameter to the overlapped versions of send and receive calls ( WSASend, WSASendTo, WSARecv, WSARecvFrom). The event object, which is cleared when first created, is set by the transport providers when the associated overlapped I/O operation has completed, either successfully or with errors. Each event object created by WSACreateEventshould have a matching WSACloseEventto destroy it.

In 32-bit environments, event object - related functions, including WSACreateEvent, WSACloseEvent, WSASetEvent, and WSAResetEvent, are directly mapped to the corresponding native Win32 functions, using the same function name, but without the WSA prefix.

See Also