select function winsock

Win32Result<int> select(
  1. int nfds,
  2. Pointer<FD_SET>? readfds,
  3. Pointer<FD_SET>? writefds,
  4. Pointer<FD_SET>? exceptfds,
  5. Pointer<TIMEVAL>? timeout,
)

Determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.

To learn more, see learn.microsoft.com/windows/win32/api/winsock2/nf-winsock2-select.

Implementation

Win32Result<int> select(
  int nfds,
  Pointer<FD_SET>? readfds,
  Pointer<FD_SET>? writefds,
  Pointer<FD_SET>? exceptfds,
  Pointer<TIMEVAL>? timeout,
) {
  final result_ = select_Wrapper(
    nfds,
    readfds ?? nullptr,
    writefds ?? nullptr,
    exceptfds ?? nullptr,
    timeout ?? nullptr,
  );
  return Win32Result(value: result_.value.i32, error: result_.error);
}