2

I would like to be able to use Tor programmatically in a c# application, for example I could have a function:

GetViaTor(someUrl);

What I currently do is I run the Tor process,wait a sufficient amount of time for it to connect, connect to it as a proxy and then run through it. I don't like that, it feels like a hack, opens a new process, I have to wait an arbitrary amount of time, and I have no feedback from the process ( i.e. IsTorGood())

I know that c# doesn't support socks, and if there was a solution for c/c++ that I could expose as unmanaged code, that too would help. I also know that Tor was written in c, so this seems all too possible, but I just don't understand how to do what I want from the source code.

P.S.

I know this may seem like a duplicate of some other questions, but I looked at them and couldn't understand what to do with the answers given ( some applied to java, some said to use it as a proxy (which I took to mean manually))

2
  • Try this out.
    – user3349
    Aug 19, 2014 at 6:07
  • How is that different then what i currently do? I want it to be embedded in the code, or am i not understanding what is privoxy?
    – Binyamin
    Aug 19, 2014 at 14:29

1 Answer 1

2

You can use a third party .net socks library to add support for socks proxy in your code, there are several to choose from.

There is a guide written here for c#

https://tor.stackexchange.com/a/2131/112

What i would do myself is to run the tor process next to the app process and just let it sit there and run in the background, then pipe the app through a socks library that uses the lib to connect to tor process.

The first initial startup will take some time since it needs to bootstrap to the network (regardless of how you implement it), after that just let it sit there for as long as your application is running.

It makes no sense to do the bootstrap every time you run your function.

implement it as what the tor browser bundle is doing to the bundled firefox.

1
  • Yeah, that's what I do, I run tor.exe in the background and let it run for the duration of the application.
    – puser
    Aug 20, 2014 at 10:56

You must log in to answer this question.

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