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...
Re: QT Network Proxy Configuration
What classes do you use to implement the network part of the application?
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.
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.
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.
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()?
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.
Re: QT Network Proxy Configuration
So why don't you take a sniffer and do what I said?