QTcpSocket state always connected, even unplugging ethernet wire
I have a QTcpSocket and I am reading into a loop. Each time a full packet has been read, or there has been an error, I manually check the status of the socket inside the loop, with: while(true){ if(socket->state()==QAbstractSocket::ConnectedState){ qDebug()<<"Socket status: connected. Looking for packets..."; if(socket->waitForReadyRead(2000)){ //... } When I execute de program, once connected and the loop starts, it always prints qDebug()<<"Socket status: connected. Looking for packets..." ; and then stucks at waitForReadyRead until some data is ready to be read. The problem is that