[Qt-interest] Transferring a QPixmap through QTcpSocket

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Thu Apr 7 13:38:46 CEST 2011


> The client receives some data, but how to I:
>     1. Ensure that all of the sent data is received, and

Doesn't a TCP connection ensure that, i.e no packets are lost (unlike
UDP)? So once you've read all data off the socket it should be the
complete byte stream sent by your server. CMIIW.


>     2. Convert the received data into a QPixmap so that it can be displayed.

Now, I'm not sure if QDataStream adds its own meta-info on top of the
raw data (maybe someone on the list can point out the specific of how
an image is serialized), but once you get a pointer to your pixmap
data, you can convert it using QPixmap::loadFromData(const QByteArray
&...).

HTH,
-mandeep

>
> I know it sounds simple but i have racked  my brains for several days now
> and I just cant seem to get it. Please assist.
>
> Thank you in advance,
>
> Joshua W.



More information about the Qt-interest-old mailing list