Module compiler

io::net::tcp

connect and connect_timeout try every address the host name resolves to under one deadline; listen uses the first. A timeout of 0 or less waits forever. Prefer an explicit IP such as 127.0.0.1 for servers when the address family matters.

Built into the compiler.

Import what you use (use path::* is not allowed):

use io::net::tcp::{accept, connect};

Functions#

NameDescription
acceptAccepts one pending connection on listener without waiting.
connectOpens a TCP connection to host on port.
connect_timeoutOpens a TCP connection to host on port, giving up after ms milliseconds.
listenOpens a TCP socket listening on host and port.
local_addrReturns the local (host, port) of a TCP listener or connected TCP stream.
peer_addrReturns the remote (host, port) of a connected TCP stream.
set_nodelayTurns TCP_NODELAY on or off for a TCP stream.
shutdownShuts down the reading half, the writing half, or both halves of a TCP stream.
↑ ↓ navigate ↵ open