implemented an echo server
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user