Using write_all().

This commit is contained in:
Elias Rohrer 2020-02-17 16:17:13 +01:00
parent c4f0056856
commit 2852083ff3
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ fn main() {
if let Ok(mut stream) = TcpStream::connect(address) { if let Ok(mut stream) = TcpStream::connect(address) {
// Send the message // Send the message
let _ = stream.write(encode::serialize(&first_message).as_slice()); let _ = stream.write_all(encode::serialize(&first_message).as_slice());
println!("Sent version message"); println!("Sent version message");
// Wait for reply and close stream // Wait for reply and close stream
@ -42,7 +42,7 @@ fn main() {
payload: message::NetworkMessage::Verack, payload: message::NetworkMessage::Verack,
}; };
let _ = stream.write(encode::serialize(&second_message).as_slice()); let _ = stream.write_all(encode::serialize(&second_message).as_slice());
println!("Sent verack message"); println!("Sent verack message");
} }
message::NetworkMessage::Verack => { message::NetworkMessage::Verack => {