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.
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.