You are assuming that readyRead() will be called once for each complete 'line' from the sender. This will rarely be the case. You cannot assume the first character in a read is the first character of a line, that the last character is the end of a line, or that you have only parts of a single line.
You must buffer what is received until you can find a complete line in the data and then process it. You must leave any unprocessed data in the buffer.
It it also not clear that you are sending a line ending, e.g. CR and/or LF, that the receiver will be looking for when reading a line.




Reply With Quote
Bookmarks