Module tokio::net::tcp

source ·
Expand description

TCP bindings for tokio.

Connecting to an address, via TCP, can be done using TcpStream’s connect method, which returns ConnectFuture. ConnectFuture implements a future which returns a TcpStream.

To listen on an address TcpListener can be used. TcpListener’s incoming method can be used to accept new connections. It return the Incoming struct, which implements a stream which returns TcpStreams.

Structs

Future returned by TcpStream::connect which will resolve to a TcpStream when the stream is connected.
Stream returned by the TcpListener::incoming function representing the stream of sockets received from a listener.
An I/O object representing a TCP socket listening for incoming connections.
An I/O object representing a TCP stream connected to a remote endpoint.