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

This function reports occurrences of network events for the indicated socket.

Syntax

int WSPEnumNetworkEvents(
  SOCKET 
s,
  WSAEVENT 
hEventObject,
  LPWSANETWORKEVENTS 
lpNetworkEvents,
  LPINT 
lpErrno 
);

Parameters

s

[in] Descriptor identifying the socket.

hEventObject

[in] An optional handle identifying an associated event object to be reset.

lpNetworkEvents

[out] Pointer to a WSANETWORKEVENTSstructure that is filled with a record of occurred network events and any associated error codes. The WSANETWORKEVENTSstructure is defined in the following text.

lpErrno

[out] Pointer to the error code.

Return Value

The return value is zero if the operation was successful. Otherwise, the value SOCKET_ERROR is returned, and a specific error number is available in lpErrno.

The following table shows the possible error codes.

Error value Description

WSAENETDOWN

Network subsystem has failed.

WSAEINVAL

Indicates that one of the specified parameters was invalid.

WSAEINPROGRESS

A blocking Windows Sockets call is in progress, or the service provider is still processing a callback function.

WSAENOTSOCK

Descriptor is not a socket.

Remarks

This function is used to report network events that have occurred for the indicated socket since the last invocation of this function. It is intended for use in conjunction with WSPEventSelect, which associates an event object with one or more network events. Recording of network events commences when WSPEventSelectis called with a nonzero lNetworkEventsparameter and remains in effect until another call is made to WSPEventSelectwith the lNetworkEventsparameter set to zero.

This function only reports network activity and errors nominated through WSPEventSelect. See the description of WSPSelectto find out how this function reports network activity and errors.

The socket's internal record of network events is copied to the structure referenced by lpNetworkEvents, after which the internal network events record is cleared. If hEventObjectis non-NULL, the indicated event object is also reset. The Windows Sockets provider guarantees that the operations of copying the network event record, clearing it, and resetting any associated event object are atomic, such that the next occurrence of a nominated network event will cause the event object to become set. In the case of this function returning SOCKET_ERROR, the associated event object is not reset and the record of network events is not cleared.

The following code sample shows how the WSANETWORKEVENTSstructure is defined.

Copy Code
typedef struct _WSANETWORKEVENTS {
	 long lNetworkEvents;
	 int iErrorCode[FD_MAX_EVENTS];
} WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS;

The lNetworkEventmember of the structure indicates which of the FD_XXX network events have occurred. The iErrorCodearray is used to contain any associated error codes, with array index corresponding to the position of event bits in lNetworkEvents. The identifiers such as FD_READ_BIT and FD_WRITE_BIT can be used to index the iErrorCodearray.

Note that only those elements of the iErrorCodearray are set that correspond to the bits set in lNetworkEventsmember. Other members are not modified (this is important for backward compatibility with the Windows Socket 2 SPI clients that are not aware of new FD_ROUTING_INTERFACE_CHANGE and FD_ADDRESS_LIST_CHANGE events).

The following tables show the error codes that can be returned along with the respective network event.

Event: FD_CONNECT

Error Value Description

WSAEAFNOSUPPORT

Addresses in the specified family cannot be used with this socket.

WSAECONNREFUSED

Attempt to connect was forcefully rejected.

WSAENETUNREACH

Network cannot be reached from this host at this time.

WSAENOBUFS

No buffer space is available. The socket cannot be connected.

WSAETIMEDOUT

Attempt to connect timed out without establishing a connection.

Event: FD_CLOSE

Error Value Description

WSAENETDOWN

Network subsystem has failed.

WSAECONNRESET

Connection was reset by the remote side.

WSAECONNABORTED

Connection was terminated due to a time-out or other failure.

Event: FD_READ

Event: FD_WRITE

Event: FD_OOB

Event: FD_ACCEPT

Event: FD_ADDRESS_LIST_CHANGE

Event: FD_ROUTING_INTERFACE_CHANGE

Error Value Description

WSAENETUNREACH

Specified destination is no longer reachable.

WSAENETDOWN

Network subsystem has failed.

Error Value Description

WSAENETDOWN

Network subsystem has failed.

Requirements

Header ws2spi.h
Library Ws2.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

WSPEventSelect

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.