I'm using a QTcpSocket to send a series of commands.
For one of the commands I want to limit the response buffer as I am only interested in the first two lines of the response.
So, just before I send this command, I limit the readBufferSize to a very low number (64 for example) and I use the readLine() function a couple of times.
This works very well.
But after I've finished with this command, I need to process the data for the next command. However, since I used readLine(), there's still some bytes in the socket buffer from the previous command. I didn't use the read() command to read the entire buffer.
My question now is, is there a way to clear the socket buffer before sending the next command?
I do have a solution though, just read the entire buffer with the read() command. But readLine is a little easier (read: I'm lazy) and I wondered if I could clear the remaining buffer.
Bookmarks