Microsoft Docs

WSAResetEvent Function

The WSAResetEvent function resets an event object to the signaled state.

Syntax

BOOL WSAResetEvent(
      [in]      WSAEVENT hEvent
    );

Parameters

Return Value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To get extended error information, call WSAGetLastError.

Parameters

Return Value

Remarks

A Winsock event object is a synchronization object that can be used to signal the occurrence of events. Applications can use Winsock event objects to coordinate the activities of multiple threads or to notify one thread of an event occurring in another thread.

The WSAResetEvent function is used to set the state of the specified event object to signaled. This means that any threads that are waiting on the event object will be awakened.

Unlike the standard Windows API SetEvent function, WSAResetEvent is intended to be used with Winsock event objects that are created by WSACreateEvent. It is typically used in conjunction with WSAWaitForMultipleEvents or WSAEnumNetworkEvents.

The event object's state remains signaled until it is explicitly reset to non-signaled by calling WSAResetEvent, or until a function that implicitly resets the event is called (e.g., some network event notification mechanisms).

Important Note:

The naming WSAResetEvent is somewhat counter-intuitive. In the standard Win32 API, SetEvent signals an event, and ResetEvent (or WSAResetEvent in Winsock) actually *unsignals* it. This function, WSAResetEvent, performs the action of signaling the event, making it visible to waiting threads.

For event objects created with WSACreateEvent, the default state is non-signaled.

Requirements

Client: Windows Vista and later versions.

Server: Windows Server 2008 and later versions.

Header: Winsock2.h

Library: Ws2_32.lib

DLL: Ws2_32.dll