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);
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);
To copy to clipboard, switch view to plain text mode
Bookmarks