Skip to content

Latest commit

 

History

History
184 lines (124 loc) · 5.27 KB

nf-winsock2-wsacreateevent.md

File metadata and controls

184 lines (124 loc) · 5.27 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winsock2.WSACreateEvent
WSACreateEvent function (winsock2.h)
The WSACreateEvent function creates a new event object.
WSACreateEvent
WSACreateEvent function [Winsock]
_win32_wsacreateevent_2
winsock.wsacreateevent_2
winsock2/WSACreateEvent
winsock\wsacreateevent_2.htm
WinSock
cff3bc31-f34c-4bb2-9004-5ec31d0a704a
12/05/2018
WSACreateEvent, WSACreateEvent function [Winsock], _win32_wsacreateevent_2, winsock.wsacreateevent_2, winsock2/WSACreateEvent
winsock2.h
Windows
Windows 8.1, Windows Vista [desktop apps \| UWP apps]
Windows Server 2003 [desktop apps \| UWP apps]
Ws2_32.lib
Ws2_32.dll
Windows
19H1
WSACreateEvent
winsock2/WSACreateEvent
c++
APIRef
kbSyntax
DllExport
Ws2_32.dll
WSACreateEvent

WSACreateEvent function

-description

The WSACreateEvent function creates a new event object.

-returns

If no error occurs, WSACreateEvent returns the handle of the event object. Otherwise, the return value is WSA_INVALID_EVENT. To get extended error information, call WSAGetLastError.

Error code Meaning
WSANOTINITIALISED
A successful WSAStartup call must occur before using this function.
WSAENETDOWN
The network subsystem has failed.
WSAEINPROGRESS
A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSA_NOT_ENOUGH_MEMORY
Not enough free memory available to create the event object.

-remarks

The WSACreateEvent function creates a manual-reset event object with an initial state of nonsignaled. The handle of the event object returned cannot be inherited by child processes. The event object is unnamed.

The WSASetEvent function can be called to set the state of the event object to signaled. The WSAResetEvent function can be called to set the state of the event object to nonsignaled. When an event object is no longer needed, the WSACloseEvent function should be called to free the resources associated with the event object.

Windows Sockets 2 event objects are system objects in Windows environments. Therefore, if a Windows application wants to use an auto-reset event rather than a manual-reset event, the application can call the CreateEvent function directly. The scope of an event object is limited to the process in which it is created.

Windows Phone 8: This function is supported for Windows Phone Store apps on Windows Phone 8 and later.

Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.

-see-also

CreateEvent

WSACloseEvent

WSAEnumNetworkEvents

WSAEventSelect

WSAGetOverlappedResult

WSARecv

WSARecvFrom

WSAResetEvent

WSASend

WSASendTo

WSASetEvent

WSAWaitForMultipleEvents

Winsock Functions

Winsock Reference