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#
| Name | Description |
|---|---|
accept | Accepts one pending connection on listener without waiting. |
connect | Opens a TCP connection to host on port. |
connect_timeout | Opens a TCP connection to host on port, giving up after ms milliseconds. |
listen | Opens a TCP socket listening on host and port. |
local_addr | Returns the local (host, port) of a TCP listener or connected TCP stream. |
peer_addr | Returns the remote (host, port) of a connected TCP stream. |
set_nodelay | Turns TCP_NODELAY on or off for a TCP stream. |
shutdown | Shuts down the reading half, the writing half, or both halves of a TCP stream. |