Skip to content

Commit 310fbc2

Browse files
committed
use big endian
1 parent 06ed371 commit 310fbc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/server/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<S> Client<S> {
7373

7474
// Send the length first as network endian.
7575
self.stream
76-
.write_all(length.to_ne_bytes().as_slice())
76+
.write_all(length.to_be_bytes().as_slice())
7777
.await?;
7878

7979
// Send the actual message next.
@@ -101,7 +101,7 @@ impl<S> Client<S> {
101101

102102
// Parse the length
103103
let message_length: usize =
104-
MsgLength::from_ne_bytes(self.buf[..size_of::<MsgLength>()].try_into()?).try_into()?;
104+
MsgLength::from_be_bytes(self.buf[..size_of::<MsgLength>()].try_into()?).try_into()?;
105105

106106
// Verify the length
107107
if message_length == 0 {

0 commit comments

Comments
 (0)