Using write_all().
This commit is contained in:
parent
c4f0056856
commit
2852083ff3
|
@ -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 => {
|
||||||
|
|
Loading…
Reference in New Issue