Skip to content

Commit 73cdf31

Browse files
samueltardieutaiki-e
authored andcommitted
Use write_all() to ensure that the whole response gets sent
1 parent 9cc89b5 commit 73cdf31

File tree

1 file changed

+1
-1
lines changed
  • examples/09_01_sync_tcp_server/src

1 file changed

+1
-1
lines changed

examples/09_01_sync_tcp_server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ fn handle_connection(mut stream: TcpStream) {
3434
// Write response back to the stream,
3535
// and flush the stream to ensure the response is sent back to the client
3636
let response = format!("{status_line}{contents}");
37-
stream.write(response.as_bytes()).unwrap();
37+
stream.write_all(response.as_bytes()).unwrap();
3838
stream.flush().unwrap();
3939
}

0 commit comments

Comments
 (0)