1
0
Fork 0
mirror of https://github.com/dadada/portfs.git synced 2025-06-07 09:33: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

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target
**/*.rs.bk

6
Cargo.lock generated Normal file
View file

@ -0,0 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "portfs"
version = "0.1.0"

7
Cargo.toml Normal file
View file

@ -0,0 +1,7 @@
[package]
name = "portfs"
version = "0.1.0"
authors = ["Tim Schubert <mail@timschubert.net>"]
edition = "2018"
[dependencies]

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),
}
}
}