pub fn socket(
domain: AddressFamily,
type_: SocketType,
protocol: Option<Protocol>,
) -> Result<OwnedFd>
Expand description
socket(domain, type_, protocol)
—Creates a socket.
POSIX guarantees that socket
will use the lowest unused file descriptor,
however it is not safe in general to rely on this, as file descriptors may
be unexpectedly allocated on other threads or in libraries.
To pass extra flags such as SocketFlags::CLOEXEC
or
SocketFlags::NONBLOCK
, use socket_with
.