Results 1 to 8 of 8

Thread: QT Network Proxy Configuration

  1. #1
    Join Date
    Aug 2006
    Location
    Chennai, India
    Posts
    34
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QT Network Proxy Configuration

    Hi,

    I,m trying to develop a Messenger. I'm in a LAN and I use a proxy server to coneect to internet. In my application, I set the proxy settings as mentioned int the QNetworkProxy Class reference. But it fails when I try to connect through the proxy, it works fine within the LAN!

    I feel the problem is in the proxy settings. Can anyone help me?

    Thanks in advance...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT Network Proxy Configuration

    What classes do you use to implement the network part of the application?

  3. #3
    Join Date
    Aug 2006
    Location
    Chennai, India
    Posts
    34
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Network Proxy Configuration

    I'm using QTcpServer and QTcpSocket classes for building the network.

    In the QNetworkProxy, I'm setting the following details.
    QNetworkProxy proxy;
    proxy.setHostName("XXX.XXX.XXX.XXX");
    proxy.setPort(1080);
    proxy.setUser("username");
    proxy.setPassword("password");
    proxy.setType(QNetworkProxy::HttpProxy); //our network is Http
    QNetworkProxy::setApplicationProxy(proxy);

    Have to do anything more.

    Thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT Network Proxy Configuration

    So what happens if you try to connect? Does the connection try to go through the proxy? Also make sure your proxy object doesn't go out of scope during the lifetime of all the sockets using the proxy.

  5. #5
    Join Date
    Aug 2006
    Location
    Chennai, India
    Posts
    34
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT Network Proxy Configuration

    Thanks for your reply.

    Server is within our LAN. We have one Static IP and whenever a client request for that IP with specific Port number that will automatically re-direct to my Server.
    Problem is here. Server is listening properly( listen(QHostAddress::Any, Portvalue) ).

    But the Client couldn't be communicate with the Server by requesting to the Static IP/port.
    (Client also within our LAN). The same QNetworkProxy have been set in the Client code also.

    What should I have to do more in Client code..?

    Thanks.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT Network Proxy Configuration

    Please take a network sniffer and inspect the network traffic to determine if clients are connecting to the proxy. Oh, and I assume you did set the proxy on those sockets you want it active for using QAbstractSocket::setProxy()?

  7. #7
    Join Date
    Aug 2006
    Location
    Chennai, India
    Posts
    34
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: QT Network Proxy Configuration

    While connecting via QNetworkProxy, the proxyAuthenticationRequired ( QNetworkProxy , QAuthenticator* ) signal is not emitting.

    FYI :- Client and Server is within the LAN.

    TcpSocket->connectToHost( local IP of Server, PORT);
    If we connect through Intranet IP address(like above) it is working fine. Client connects with Server.

    TcpSocket->connectToHost( Proxy IP, Port);
    If the Connecting Host Address is, our Proxy IP. When we send a request to that IP, that will redirect that request to the server system which is connected with our LAN.
    This is not working. The signal proxyAuthenticationRequired() is not emitting.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QT Network Proxy Configuration

    So why don't you take a sniffer and do what I said?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.