recvfrom function winsock

Win32Result<int> recvfrom(
  1. SOCKET s,
  2. PSTR buf,
  3. int len,
  4. int flags,
  5. Pointer<SOCKADDR>? from,
  6. Pointer<Int32>? fromlen,
)

Receives a datagram and stores the source address.

To learn more, see learn.microsoft.com/windows/win32/api/winsock/nf-winsock-recvfrom.

Implementation

Win32Result<int> recvfrom(
  SOCKET s,
  PSTR buf,
  int len,
  int flags,
  Pointer<SOCKADDR>? from,
  Pointer<Int32>? fromlen,
) {
  final result_ = recvfrom_Wrapper(
    s,
    buf,
    len,
    flags,
    from ?? nullptr,
    fromlen ?? nullptr,
  );
  return .new(value: result_.value.i32, error: result_.error);
}