Ralf Wickum
Ralf Wickum

Reputation: 3284

Can QNetworkProxy::setHostname accept IP adresses?

I have a QNetworkProxy where I also set the Hostname via

QNetworkProxy * currentProxy = new QNetworkProxy();
currentProxy->setHostName("123.234.123.234");

But I do not get any conenction. I guess the method does not take any IP adresses?

Upvotes: 0

Views: 1288

Answers (1)

demonplus
demonplus

Reputation: 5801

In standard Qt examples they use this method like:

 QNetworkProxy proxy;
 proxy.setType(QNetworkProxy::Socks5Proxy);
 proxy.setHostName("proxy.example.com");
 proxy.setPort(1080);
 proxy.setUser("username");
 proxy.setPassword("password");
 QNetworkProxy::setApplicationProxy(proxy);

But actually host name can be passed as IP address:

QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(QString("http://192.168.1.1"));
proxy.setPort(8080);
QNetworkProxy::setApplicationProxy(proxy);

You should check the proper settings of your system first of all.

Upvotes: 1

Related Questions