diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2024-06-03 16:54:12 +0300 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2024-06-03 16:54:12 +0300 |
| commit | 430e98701f3e66187898ee752a941d68dcc394b8 (patch) | |
| tree | bb05519ca918a54e9753e08f911fd55c01cf65ec /src | |
| parent | 7dbd2e9e451f570dc0ffa804b0db8ff49bde9e77 (diff) | |
| download | tiny-server-430e98701f3e66187898ee752a941d68dcc394b8.tar.xz tiny-server-430e98701f3e66187898ee752a941d68dcc394b8.zip | |
codecrafters submit [skip ci]
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/main.rs b/src/main.rs index 01f209e..07777f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,16 @@ -// Uncomment this block to pass the first stage -// use std::net::TcpListener; +use std::net::TcpListener; 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!"); + let listener = TcpListener::bind("127.0.0.1:4221").unwrap(); - // Uncomment this block to pass the first stage - // - // 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); - // } - // } - // } + for stream in listener.incoming() { + match stream { + Ok(_stream) => { + println!("accepted new connection"); + } + Err(e) => { + println!("error: {}", e); + } + } + } } |
