How to transmit a picture via socket?
I want to transmit data which text and picture are mixed, then display them in a QTextBrowser. What to do? Should I change a QImage into a QByteArray. But how to detach text and picture. Is there any solution?
What I want is socket read/write these different types data as binary stream. For example, I write a stream "hello world" as a text and append "0x01,0x02..."
as a picture binary stream. How can client recognize which part is text, which part is picture binary stream.
I think maybe I can use XML to mark it. Is there another good way?
You write them (qimage and qstring) into the byte array (one after the other) using the << operator. On "the other side" you get them back (in the same order in which you wrote them in) using the >> operator.
Just so. The operators will do the work for you. Nothing to worry about.
You can refer this post as well http://qt-project.org/forums/viewthread/44940/