I am trying to send socket requests in C++ to an onion link I am hosting with tor services and node.js. My node.js server is being hosted on port 8080. When I try to send socket requests to localhost:8080, it works perfectly fine.

However, when I try to send them to my onion link, it does not work.

The library I am using to handle sockets is https://github.com/socketio/socket.io-client-cpp.

The C++ code:

sio::client h;
connection_listener l(h);

h.set_open_listener(std::bind(&connection_listener::on_connected, &l));
h.set_close_listener(std::bind(&connection_listener::on_close, &l,std::placeholders::_1));
h.set_fail_listener(std::bind(&connection_listener::on_fail, &l));
// it fails to connect to the onion link, but works perfectly fine with http://localhost:8080/

Why is this not working for the onion link? Do onion links work differently in this case?

Is there any method I can use to achieve this?

  • I don't know anything about this library, but you're routing it over Tor right? (using the SOCKS proxy?) – Steve Jun 16 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.