Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

WSAPOLLFD structure

The WSAPOLLFD structure stores socket information used by the WSAPoll function.

Syntax


typedef struct pollfd {
  SOCKET fd;
  short  events;
  short  revents;
} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;

Members

fd

Type: SOCKET

The identifier of the socket for which to find status. This parameter is ignored if set to a negative value. See Remarks.

events

Type: short

A set of flags indicating the type of status being requested. This must be one or more of the following.

FlagMeaning
POLLPRIPriority data may be read without blocking. This flag is not supported by the Microsoft Winsock provider.
POLLRDBANDPriority band (out-of-band) data can be read without blocking.
POLLRDNORMNormal data can be read without blocking.
POLLWRNORMNormal data can be written without blocking.

 

The POLLIN flag is defined as the combination of the POLLRDNORM and POLLRDBAND flag values. The POLLOUT flag is defined as the same as the POLLWRNORM flag value.

revents

Type: short

A set of flags that indicate, upon return from the WSAPoll function call, the results of the status query. This can a combination of the following flags.

FlagDescription
POLLERRAn error has occurred.
POLLHUPA stream-oriented connection was either disconnected or aborted.
POLLNVALAn invalid socket was used.
POLLPRIPriority data may be read without blocking. This flag is not returned by the Microsoft Winsock provider.
POLLRDBANDPriority band (out-of-band) data may be read without blocking.
POLLRDNORMNormal data may be read without blocking.
POLLWRNORMNormal data may be written without blocking.

 

The POLLIN flag is defined as the combination of the POLLRDNORM and POLLRDBAND flag values. The POLLOUT flag is defined as the same as the POLLWRNORM flag value.

For sockets that do not satisfy the status query, and have no error, the revents member is set to zero upon return.

Remarks

The WSAPOLLFD structure is defined on Windows Vista and later.

The WSAPOLLFD structure is used by the WSAPoll function to determine the status of one or more sockets. The set of sockets for which status is requested is specified in fdarray parameter, which is an array of WSAPOLLFD structures. An application sets the appropriate flags in the events member of the WSAPOLLFD structure to specify the type of status requested for each corresponding socket. The WSAPoll function returns the status of a socket in the revents member of the WSAPOLLFD structure.

If the fd member of the WSAPOLLFD structure is set to a negative value, the structure is ignored by the WSAPoll function call, and the revents member is cleared upon return. This is useful to applications that maintain a fixed allocation for the fdarray parameter of WSAPoll; such applications need not waste resources compacting elements of the array for unused entries or reallocating memory. It is unnecessary to clear the revents member prior to calling the WSAPoll function.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Winsock2.h

See also

WSAPoll
recv
connect
accept

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.