Receiving Data With Spaces, Thru Sockets
Solution 1:
The stuff you are getting back in the file is not your original text, but QString serialization form, which is unsuprisingly UTF-16. If you want your text back, read the input QDataStream back to QString and save that into file.
While prefixing your data with a length is generally a good idea, it is absolutely redundant with QString >> QDataStream. Read up something here or here. Moreover you have developed a mind boggingly obfuscated way which i suspect is doing nothing. QByteArray is not implementing QIODevice (indeed, why it should) so your out.device()->seek() is a base virtual implementation, empty and just returning true. I won't be surprised if your length "header" is found at the end of your serialization dump file.
Edit: i think that your html transport might start working correctly only by leaving out the confused quint operation completely and use out
QTextStream instead of QByteStream.
Solution 2:
I posted the solution for my case in the other post.
Thanks you all for the attention
Post a Comment for "Receiving Data With Spaces, Thru Sockets"