Код: Выделить всё
VServerThread::~VServerThread(){
qDebug("Server thread: destroy");
}
void VServerThread::run() {
QTcpSocket tcpSocket;
if (!tcpSocket.setSocketDescriptor(socketDescriptor)) {
emit error(tcpSocket.error());
return;
}
connect(&tcpSocket,SIGNAL(disconnected()),this,SLOT(disconnected()));
connect(&tcpSocket,SIGNAL(readyRead()),this,SLOT(getData()));
qDebug("Server thread: starting");
this->exec();
qDebug("Server thread: stoped");
tcpSocket.disconnectFromHost();
if (tcpSocket.state() == QAbstractSocket::UnconnectedState || tcpSocket.waitForDisconnected(1000)) qDebug("Disconnected!");
}
void VServerThread::disconnected(void){
qDebug("Server thread: disconnect");
this->exit(0);
};
Запускаю, коннекчусь клиентом, затем закрываю приложение-клиент. (в нем дисконект ни как не рализован - т.е. "нештатный" разрыв)
В консоли остается следующее:
Код: Выделить всё
Server: Start
Server: New Connection
Server thread: starting
QSocketNotifier: Invalid socket 12 and type 'Read', disabling...
Server thread: disconnect
Server thread: stoped
Disconnected!
Server thread: destroy
Напрягает сообщение "QSocketNotifier:...." Его стоит както обрабатывать? Или это естественное сообщение при разрыве связи?