From ed17d7f0ee4fca6c2428589f43e8a4a262144d35 Mon Sep 17 00:00:00 2001 From: timvisee Date: Tue, 20 Feb 2018 00:05:00 +0100 Subject: [PATCH] Flush the write buffer to the pixelflut server --- README.md | 2 +- src/pix/client.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 040b2c4..b587670 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ git clone https://github.com/timvisee/pixelpwnr.git cd pixelpwnr # Install pixelpwnr -cargo install +cargo install -f # Start using pixelpwnr pixelpwnr --help diff --git a/src/pix/client.rs b/src/pix/client.rs index 5c6c4d8..8ceb6f3 100644 --- a/src/pix/client.rs +++ b/src/pix/client.rs @@ -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(())