#include <QTcpSocket>#include <QByteArray>#include <QThread>#include <QHostAddress>#include <QDebug>int main(){ QTcpSocket socket; socket.bind(1234); /* Выполняем подключение */ socket.connectToHost(QHostAddress("192.168.0.5"), 1234); while (socket.state() != QTcpSocket::SocketState::ConnectedState) qDebug() << socket.state(); qDebug() << "Connected"; QByteArray buf; while (true) { buf.clear(); buf.append(static_cast<char>(0x02)); qDebug() << socket.write(buf); socket.flush(); QThread::sleep(1); } return 0;}