implemented an echo server

This commit is contained in:
2019-09-01 18:32:40 +02:00
parent 658400051e
commit 139c1b1f01
2 changed files with 4 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ impl Settings {
Settings {
foreground: matches.is_present("FOREGROUND"),
listen: matches.value_of("LISTEN").unwrap_or("default").to_owned(),
listen: matches.value_of("LISTEN").unwrap_or("127.0.0.1").to_owned(),
plugins: matches.value_of("PLUGIN").unwrap_or("filesystem").split(",").map(|s| s.to_string()).collect(),
port: FromStr::from_str(matches.value_of("PORT").unwrap_or("70")).unwrap()
}

View File

@@ -21,9 +21,9 @@ fn main() {
println!("Loading plugins {:?}", settings.plugins);
println!("Listening on port {}", settings.port);
let addr = format!("{}:{}", settings.listen, settings.port)
.parse::<SocketAddr>()
.unwrap();
let addr: SocketAddr = format!("{}:{}", settings.listen, settings.port)
.parse()
.expect("Unable to parse socket addr");
let listener = TcpListener::bind(&addr).unwrap();
let server = listener