#include "client.h"

client::client(QWidget *parent)
    : QMainWindow(parent)
{

    QTcpSocket *socket = new QTcpSocket(this);
    socket->connectToHost("192.168.1.100", 8000);
    QByteArray block;
    QDataStream in(&block, QIODevice::ReadOnly);
//    in.setVersion(QDataStream::Qt_5_15);
    while (socket->bytesAvailable() < (int)sizeof(quint32))
    { if (!socket->waitForReadyRead()) {
            return;
        }
    }
    quint32 blockSize = 0;
    in >> blockSize;
    while (socket->bytesAvailable() < blockSize)
    { if (!socket->waitForReadyRead())
        {
            return;
        }
    }
    QByteArray data = socket->read(blockSize);
    QPixmap pixmap;
    pixmap.loadFromData(data);
    label = new QLabel(this);
    label->setPixmap(pixmap);
    label->setScaledContents(true);
    label->show();

}

client::~client()
{
}

the labell is not displaying my live video from the server side code

#include "server.h"

server::server(QObject *parent) : QObject(parent)
{
    tcpServer = new QTcpServer(this);
    tcpServer->listen(QHostAddress::Any,8000);

    camera c;

    socket = new QTcpSocket(this);
    socket = tcpServer->nextPendingConnection();
    QByteArray block;
    QDataStream out(&block,QIODevice::WriteOnly);
//    out.setVersion()

    while(true)
    {
        QImage image = c.viewfinder->grab().toImage();
        QByteArray ba;
        QBuffer buffer(&ba);
        buffer.open(QIODevice::WriteOnly);
        image.save(&buffer,"JPG");
        out << quint32(ba.size());
        socket->wr