Question about how to send images in socket programming?

I have a couple of questions about sending images.

How to handle various types of files, jpeg, png, etc.

If the file is large, I want to use sequence numbers ... but I do not know how to stop recording if I do not know the number of sequence numbers.

My knowledge of transferring images / files is almost absent. I have never programmed anything like this before. I was hoping to get some tips and tricks =)

Thanks a lot.

I also use QT, if that helps my situation at all.

0
source share
3 answers

TCP, , TCP , , . . , (, ).

+2

, , QImage, QDataStream QImage QByteArray, QTcpSocket write(). Qt QByteArray.

QIODevice ( QFile, ) , readAll(), QByteArray, .

, Qt. . Qt Assistant → → → .

+3

Pass them the same way as any other binary data. send(), recv(). Or no matter what abstraction Qt provides.

0
source

Source: https://habr.com/ru/post/1724215/


All Articles