minor changes

This commit is contained in:
Phuntsok Drak-pa 2018-03-21 12:55:10 +01:00
parent b9a13e29dd
commit 005d5d3b19
2 changed files with 5 additions and 3 deletions

View File

@ -19,14 +19,12 @@ fn write_to_server(stream: TcpStream) {
match &*get_entry() {
"/quit" => {
println!("Disconnecting...");
// send!("BYE");
writeln!(writer, "BYE").unwrap();
writer.flush().unwrap();
println!("Disconnected!");
return ();
}
line => {
// send!(line);
writeln!(writer, "{}", line).unwrap();
writer.flush().unwrap();
}

View File

@ -21,7 +21,11 @@ fn main() {
// Client opened //
///////////////////////////////////////////////////////////////////////
println!("Client connecting on server {}:{}", args[1], args[2]);
let mut serv = args[1].clone();
let mut serv: String = if args[1] == "localhost" {
String::from("127.0.0.1")
} else {
args[1].clone()
};
serv.push(':');
serv.push_str(&args[2]);
client::client(serv);