pub struct TcpListener(/* private fields */);Expand description
A TCP socket server, listening for connections.
After creating a TcpListener by binding it to a socket address, it listens
for incoming TCP connections. These can be accepted by calling accept or by
iterating over the Incoming iterator returned by incoming.
The socket will be closed when the value is dropped.
The Transmission Control Protocol is specified in IETF RFC 793.
§Examples
use std::net::{TcpListener, TcpStream};
fn handle_client(stream: TcpStream) {
// ...
}
fn main() -> std::io::Result<()> {
let lis