-
constructor
- tcpServer = new QTcpServer(this)
- tcpServer->serverPort()
-
if (!tcpServer->listen())
- close();
- connect(tcpServer, SIGNAL(newConnection()), this, SLOT(sendFortune()));
-
QTcpServer::newConnection()
-
Подготовка данных
- QByteArray block;
- QDataStream out(&block, QIODevice::WriteOnly);
- out <<
- QTcpSocket *clientConnection = tcpServer->nextPendingConnection();
- connect(clientConnection, SIGNAL(disconnected()), clientConnection, SLOT(deleteLater()));
- clientConnection->write(block);
- clientConnection->disconnectFromHost();