I'm trying to connect to tor from my c++ application using this tutorial, but I want to connect to the tor session that is run by Tor Browser. At the moment I cannot get past the Resp1 thing, since I'm getting Resp1[1] == 0x20.

How can I connect to the existing tor session managed by Tor Browser? Is this tutorial valid, or not any more?

  • Could you paste the source code into your question? This helps to see what you did and we can give you an answer.
    – Jens Kubieziel
    Aug 5, 2015 at 10:54
  • @JensKubieziel at the moment I have the very same code as in the tutorial (just without that Linux&Mac stuff, since I'm on Win7)
    – burtek
    Aug 5, 2015 at 12:14
  • @JensKubieziel And I've also tried using port 9150, but with no success
    – burtek
    Aug 5, 2015 at 12:14

2 Answers 2


I suggest using the stand-alone tor application (referenced in the tutorial you mention) instead of the Tor Browser Bundle. TBB appears to not open a port on 9050 as tor by itself would.

Documentation of TBB seems conflicting on what port can be used. https://www.torproject.org/docs/faq#TBBSocksPort mentions SOCKS on port 9150, though older documentation mentions an option called 'Configure ControlPort automatically' that appears to randomise the ports used by TBB.


For some reason the tutorial linked in the question does not work correctly with TorBrowser, but I managed to connect to TorBrowser socket on port 9150 and use it in my app by rewriting the app in Qt (which I was going to do sooner or later) and simply using the QNetworkProxy class:

QNetworkProxy proxy;

This answer will not help everyone, but it's kind of a workaround and it works for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .