Use `write_all` instead of `write` to handle buffers
`write` may not process the entire buffer, so if using it, it is recommended to handle the return value (number of bytes written), or strange runtime errors may occur. Since we are clearing the buffers immediately after, it seems the desired behavior is to write the entire buffer, for which `write_all` will guarantee correct behavior.
Loading
Please register or sign in to comment