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