chore: sytle
This commit is contained in:
@@ -13,22 +13,16 @@ fn main() {
|
|||||||
|
|
||||||
let mut data = [0_u8; 6]; // using 6 byte buffer
|
let mut data = [0_u8; 6]; // using 6 byte buffer
|
||||||
match stream.read_exact(&mut data) {
|
match stream.read_exact(&mut data) {
|
||||||
Ok(_) => {
|
Ok(_) => if &data == msg {
|
||||||
if &data == msg {
|
println!("Reply is ok!");
|
||||||
println!("Reply is ok!");
|
} else {
|
||||||
} else {
|
let text = from_utf8(&data).unwrap();
|
||||||
let text = from_utf8(&data).unwrap();
|
println!("Unexpected reply: {}", text);
|
||||||
println!("Unexpected reply: {}", text);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => println!("Failed to receive data: {}", e),
|
||||||
println!("Failed to receive data: {}", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => println!("Failed to connect: {}", e),
|
||||||
println!("Failed to connect: {}", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
println!("Terminated.");
|
println!("Terminated.");
|
||||||
}
|
}
|
||||||
@@ -31,10 +31,7 @@ fn main() {
|
|||||||
handle_client(stream)
|
handle_client(stream)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => println!("Error: {}", e),
|
||||||
println!("Error: {}", e);
|
|
||||||
/* connection failed */
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// close the socket server
|
// close the socket server
|
||||||
|
|||||||
Reference in New Issue
Block a user