|
WSAEnumNetworkEvents
The Windows Sockets WSAEnumNetworkEvents function discovers occurrences of network events for the indicated socket.
int WSAEnumNetworkEvents (
SOCKET s,
|
| WSAEVENT hEventObject,
|
| LPWSANETWORKEVENTS lpNetworkEvents
|
| );
|
|
Parameters
s
[in] A descriptor identifying the socket.
hEventObject
[in] An optional handle identifying an associated event object to be reset.
lpNetworkEvents
[out] A pointer to a WSANETWORKEVENTS structure which is filled with a record
of occurred network events and any associated error codes.
Remarks
This function is used to discover which network events have occurred for the
indicated socket since the last invocation of this function. It is intended for
use in conjunction with WSAEventSelect, which associates an event object with one or more network events. Recording
of network events commences when WSAEventSelect is called with a nonzero lNetworkEvents parameter and remains in effect until another call is made to WSAEventSelect with the lNetworkEvents parameter set to zero, or until a call is made to WSAAsyncSelect.
The socket's internal record of network events is copied to the structure
referenced by lpNetworkEvents, whereafter the internal network events record is cleared. If hEventObject is 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 WSANETWORKEVENTS structure is defined as follows:
typedef struct _WSANETWORKEVENTS {
long lNetworkEvents;
int iErrorCodes[FD_MAX_EVENTS];
} WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS;
The lNetworkEvents field of the structure indicates which of the FD_XXX network events have
occurred. The iErrorCodes array 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 iErrorCodes array.
The following error codes may be returned along with the respective network
event:
Event: FD_CONNECT
Error Code
| Meaning
| WSAEADDRINUSE
| The specified address is already in use.
| WSAEADDRNOTAVAIL
| The specified address is not available from the local machine.
| WSAEAFNOSUPPORT
| Addresses in the specified family cannot be used with this socket.
| WSAECONNREFUSED
| The attempt to connect was forcefully rejected.
| WSAENETUNREACH
| The 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 Code
| Meaning
| WSAENETDOWN
| The network subsystem has failed.
| WSAECONNRESET
| The connection was reset by the remote side.
| WSAECONNABORTED
| The 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_QOS
Event: FD_GROUP_QOS
Error Code
| Meaning
| WSAENETDOWN
| The network subsystem has failed.
|
Return Values
The return value is zero if the operation was successful. Otherwise, the value
SOCKET_ERROR is returned, and a specific error number may be retrieved by
calling WSAGetLastError.
Error Codes
WSANOTINITIALISED
| A successful WSAStartup must occur before using this function.
| WSAENETDOWN
| The network subsystem has failed.
| WSAEINVAL
| Indicates that one of the specified parameters was invalid.
| WSAEINPROGRESS
| A blocking Windows Sockets 1.1 call is in progress, or the service provider is
still processing a callback function.
| WSAENOTSOCK
| The descriptor is not a socket.
|
See Also
WSAEventSelect
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|