ssize_t recvfrom(int socket_fd, void *restrict buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len); ssize_t sendto(int socket_fd, void *restrict buffer, size_t length, int flags, struct sockaddr *address, socklen_t address_len);
These syscalls compliment read
and write
for socket-based IO.
They allow specifing or fetching the address of a read or write operation when
doing them, which can be vital for reading connection-less socket protocols.
Unlike doing connect
on a connection-less socket, the addresses passed
here will not affect future transactions.
When used for connection-based protocols, or when passed as NULL
,
address
and address_len
will be ignored.
flags
is right now a placeholder for future options.
These syscalls return and fail in the same ways read/write would, with
the addition of only accepting sockets as their passed socket_fd
.