1
0
Fork 0
mirror of https://github.com/dadada/portfs.git synced 2025-06-08 01:53:56 +02:00

Initial commit

This commit is contained in:
Tim Schubert 2019-05-30 22:20:47 +02:00
commit 97ee529bc7
4 changed files with 34 additions and 0 deletions

19
src/main.rs Normal file
View file

@ -0,0 +1,19 @@
use std::net::{TcpListener, TcpStream, SocketAddr};
use std::io::Result;
fn handle_client(stream: TcpStream, addr: SocketAddr) {
println!("Hello, world!");
}
fn main() -> Result<()> {
let listener = TcpListener::bind("127.0.0.1:8080")?;
// accept connections and process them serially
loop {
match listener.accept() {
Ok((socket, addr)) => handle_client(socket, addr),
Err(e) => println!("could not accept client: {:?}", e),
}
}
}