[SOLVED]Problem when using second socket.
-
Yes I do wait for the socket to connect using
if (!socket->waitForConnected(connectionTimeout)) { return false; }
And its hard to post the code as it has turned out to be quite lengthy. Yet my smtp client is a barebones version of this . Any changes that I have made could not be responsible as the way I connect and send the data is the same, and as I said it works fine by itself. As for the http server it contains a worker class that deals with sockets (moves them into a separate thread, connects to the host etc) and a tcpServer that uses the worker class in order to deal with multiple connections.
-
No after that I wait for the smtp server to respond using
waitForResponse();
after that I follow with all the procedure that has to take place in order to communicate with an smtp server, like sending the EHLO/HELO message
socket->write(text.toUtf8() + "\r\n"); if (! socket->waitForBytesWritten(sendMessageTimeout)) { throw SendMessageTimeoutException(); }
-
Yup you are correct I should have looked more carefully at my implementation. I had a placed an ! symbol incorrectly. Now as you suggested I can see the states. This is what I get
Sending verification email. QAbstractSocket::HostLookupState QAbstractSocket::ConnectingState QAbstractSocket::ConnectedState Failed to connect to host!
The last comment comes from
smtp.connectToHost()
Seems that it returns false, but at least this is a step forward.