Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Application crashes on waitForConnected when using a proxy
Forum Updated to NodeBB v4.3 + New Features

Application crashes on waitForConnected when using a proxy

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 421 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    elmi
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved