mirror of
https://github.com/dadada/portfs.git
synced 2025-06-07 17:43:56 +02:00
Initial commit
This commit is contained in:
commit
97ee529bc7
4 changed files with 34 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
**/*.rs.bk
|
6
Cargo.lock
generated
Normal file
6
Cargo.lock
generated
Normal 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
7
Cargo.toml
Normal 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
19
src/main.rs
Normal 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),
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue