Export (0) Print
Expand All
Expand Minimize

WSACreateEvent function

The WSACreateEvent function creates a new event object.

Syntax


WSAEVENT WSACreateEvent(void);

Parameters

This function has no parameters.

Return value

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 codeMeaning
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 API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winsock2.h

Library

Ws2_32.lib

DLL

Ws2_32.dll

See also

Winsock Reference
Winsock Functions
CreateEvent
WSACloseEvent
WSAEnumNetworkEvents
WSAEventSelect
WSAGetOverlappedResult
WSARecv
WSARecvFrom
WSAResetEvent
WSASend
WSASendTo
WSASetEvent
WSAWaitForMultipleEvents

 

 

Community Additions

ADD
Show:
© 2014 Microsoft