PDA

View Full Version : Qt4.1, TCP-server, Ethernet, Windows



Eugene K
2nd November 2019, 18:16
My code gives me packets loss:


clientConnection = new QTcpSocket(this);
tcpServer = new QTcpServer();
connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newConnect()));

void frmMain::newConnect()
{
clientConnection = tcpServer->nextPendingConnection();

connect(clientConnection, SIGNAL(readyRead()),
this, SLOT(receivePkg()));

connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
}

void frmMain::receivePkg()
{
read_size = clientConnection->read(buf_c, READ_BUF_SIZE);


Tell me how to create TCP-server:

-received 10+ packets (1 packet length = 200+ bytes) per 1 ms
-received packets for 10+ min
-without packets loss

May be I have to use another thread and set priority to thread.

Give me server code, please.

d_stranz
3rd November 2019, 16:38
Give me server code, please.

Maybe you could try this (https://lmgtfy.com/?q=Qt+tcp+ip+example&s=g) instead of asking us to cook and serve your dinner to you.