std::net
This is the canonical module doc for std::net.
std::net provides the hosted networking API shipped in std/net.slk:
byte-order helpers, IPv4/IPv6 address types, TCP and UDP sockets, hostname
resolution, and the current async socket integration layer.
TCP writes on Linux and macOS suppress SIGPIPE per send. If the socket
reports EPIPE, TCPStream.write, write_all, and write_string return
NetErrorKind::BrokenPipe instead of terminating the process. Other socket
errors retain their normal mapping; process-wide signal handlers are unchanged.
On Apple targets using the auto or platform security provider, builds that
import std::net link Network.framework as the platform networking provider
surface is brought online. The current public API remains the hosted socket API
documented in networking.
The detailed API contract and platform/runtime notes are documented in:
Read that page as the complete public surface for:
- byte-order helpers such as
htons,ntohs,htonl,ntohl Ipv4AddrandIpv6AddrSocketAddrV4,SocketAddrV6, andSocketAddrNetErrorKind,NetFailed, and theNet*ResultaliasesResolveIpModeandresolve_host(...)- deadline-aware
resolve_host_timeout(...)andTCPStream.connect_timeout(...) TCPStream,TCPListener,UDPv4Socket, andUDPv6Socket- current async
connect/acceptsupport
Related docs:
Source repository · Edit this page · View Markdown