Flush the write buffer to the pixelflut server

This commit is contained in:
timvisee
2018-02-20 00:05:00 +01:00
parent 13e0591fc9
commit ed17d7f0ee
2 changed files with 8 additions and 2 deletions

View File

@@ -86,7 +86,13 @@ impl Client {
fn write_command(&mut self, cmd: String) -> Result<(), Error> {
// Write the pixels and a new line
self.stream.write(cmd.as_bytes())?;
self.stream.write("\n".as_bytes())?;
self.stream.write("\r\n".as_bytes())?;
// Flush, make sure to clear the send buffer
// TODO: make flushing configurable
// TODO: make buffer size configurable
self.stream.flush()
.expect("failed to flush write buffer to server");
// Everything seems to be ok
Ok(())