It could be easier for you if you separate each message with a new line character and use a textstream instead of datastream. Then you can check if there are more lines to read and read line by line. Of course you can try to do simmilar things using QDataStream::atEnd(), but you'll probably have to use it quite often (before every read).
Bookmarks