http-server-cc/src/main.rs

23 lines
630 B
Rust
Raw Normal View History

2024-05-10 17:06:42 +00:00
// Uncomment this block to pass the first stage
2024-05-10 17:23:14 +00:00
use std::net::TcpListener;
2024-05-10 17:06:42 +00:00
fn main() {
// You can use print statements as follows for debugging, they'll be visible when running tests.
println!("Logs from your program will appear here!");
// Uncomment this block to pass the first stage
//
2024-05-10 17:23:14 +00:00
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);
}
}
}
2024-05-10 17:06:42 +00:00
}