csoler
20th May 2015, 22:31
I would like to test that an .onion site ran by TOR is actually up, using Qt. So what I do is:
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::DefaultProxy);
proxy.setHostName("127.0.0.1");
proxy.setPort(9050);
proxy.setCapabilities(QNetworkProxy::HostNameLooku pCapability | proxy.capabilities()) ;
QTcpSocket socket ;
socket.setProxy(proxy) ;
socket.connectToHost("ulno4bbebwsr23n6.onion",9023);
if(!socket.waitForConnected(5000))
std::cerr << "Error: " << socket.errorString().toStdString() << std::endl;
But what I get is an error message in the console that says "Error: Host not found". Apparently the proxy is not able to resolve the .onion address.
I tried Socks5Proxy, but that causes "Error: Operation on socket is not supported". So I suppose I should stick to the DefaultProxy type.
I'm 100% sure the onion site is alive and running. So what's wrong in my code??
Thanks in advance for any help!
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::DefaultProxy);
proxy.setHostName("127.0.0.1");
proxy.setPort(9050);
proxy.setCapabilities(QNetworkProxy::HostNameLooku pCapability | proxy.capabilities()) ;
QTcpSocket socket ;
socket.setProxy(proxy) ;
socket.connectToHost("ulno4bbebwsr23n6.onion",9023);
if(!socket.waitForConnected(5000))
std::cerr << "Error: " << socket.errorString().toStdString() << std::endl;
But what I get is an error message in the console that says "Error: Host not found". Apparently the proxy is not able to resolve the .onion address.
I tried Socks5Proxy, but that causes "Error: Operation on socket is not supported". So I suppose I should stick to the DefaultProxy type.
I'm 100% sure the onion site is alive and running. So what's wrong in my code??
Thanks in advance for any help!