PDA

View Full Version : Problem with QAbstractSocket and states.



nomadscarecrow
17th March 2010, 15:55
Hi.

I'm working on a irc class using QTcpSocket.

The class works good, and everything was ok. But now, I working on disconnections.

I load the application, makes the connection to the server, it works good.
I disable my network connection to test the disconnection, and the socket object change the states to QAbstractSocket::UnconnectedState.

My problem is, when I enable the network connection and try to reconnect to the irc server using:
this->socket->connectToHost(this->host, this->port);
I receive the next message:
QAbstractSocket::connectToHost() called when already connecting/connected to "my irc server"
I check the socket states using the stateChanged signal and several prints of the state() method on the code.

Any idea of this?
Thanks in advance

Edit:

After try some things. I set abort() on slot for error signal. I try to reconnect ... and everything looks good. But eventually the socket disconnects. When I try a re connect again ... the slots works fine.