Application crashes on waitForConnected when using a proxy
-
Hi All,
I created a small application to test a network connection. Everything worked fine if I don't use a proxy.
If I use a proxy and use wrong proxy settings i got a error message. If I use the correct proxy settings the application crashes.
Maybe someone can provide me help.Here is my code:
The proxy settings:
@
proxyTCP = new QNetworkProxy();proxyTCP->setType(QNetworkProxy::HttpProxy); proxyTCP->setHostName(pdes); proxyTCP->setPort(port_int); if (user != NULL && !user.trimmed().isEmpty()) proxyTCP->setUser(user); if (pw != NULL && !pw.trimmed().isEmpty()) proxyTCP->setPassword(pw);
@
The connection:
@
socket = new QTcpSocket(this);if (proxyTCP != NULL) { socket->setProxy(*proxyTCP); } socket->connectToHost(des, port_int); if (socket->waitForConnected(5000)) // The application chrashes here { emit processEnded(1, type, "Success", true); } else { emit processEnded(0, type, socket->errorString(), true); }
@
Thanks
Elmi