1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
use std::net::TcpListener; fn main() { let listener = TcpListener::bind("127.0.0.1:4221").unwrap(); for stream in listener.incoming() { match stream { Ok(_stream) => { println!("accepted new connection"); } Err(e) => { println!("error: {}", e); } } } }