Expand description
Non-blocking TCP and UDP sockets on raw file descriptors (Unix) and SOCKETs (Windows).
Socket owns the descriptor and closes it on drop (through std’s OwnedFd /
OwnedSocket). Every socket this module creates is non-blocking and close-on-exec
(not inheritable on Windows), and on Windows it is created overlapped so IOCP can drive it.
Operations that would block return an error of kind io::ErrorKind::WouldBlock.
Structs§
- Listen
Options - Options for
Socket::tcp_listen. - Socket
- An owned, non-blocking socket. Closed on drop.
- UdpOptions
- Options for
Socket::udp_bind.
Functions§
- default_
backlog - The default listen backlog: the system’s maximum accept queue. On Linux that is
/proc/sys/net/core/somaxconn(read once), capped at 65535, or 4096 if it can’t be read; on WindowsSOMAXCONN(the provider’s maximum); elsewhere 65535, which the kernel clamps to its ownsomaxconn. - descriptor_
limit - The process’s soft limit on open file descriptors (
RLIMIT_NOFILEon Linux);Nonewhere there is no such limit to watch (Windows) or it can’t be read. - reserve_
descriptors - The unspecified address of the same family as
addr(port 0). Grows the process’s file descriptor table to hold at leastndescriptors (capped at the softRLIMIT_NOFILE), by duplicating a descriptor to slotn - 1and closing it again. - unspecified_
like
Type Aliases§
- RawSock
- The raw OS handle of a socket: a file descriptor on Unix, a
SOCKETon Windows.