Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like my .NET app to use a proxy which i know how to do except .net doesnt support sock4a/sock5. I know how to setup my app but

How do i setup socat to at as a TCP proxy on part 1234 and use the sock5 server at 127.0.0.1:5678?

It must forward all TCP connect. I had luck with privoxy earlier but that only supports http connections

PS: I am on windows but the commands should be the same as linux

share|improve this question
    
socat has a very complete man page. –  Pierre Carrier Jul 8 '12 at 16:46
    
@PierreCarrier i cant understand it. Also it doesnt explain the error messages i gotten and neither does google. –  acidzombie24 Jul 9 '12 at 0:30
    
What protocols is the .NET application using? HTTP? –  mgorven Jul 13 '12 at 16:28
add comment

1 Answer

up vote 1 down vote accepted

You didn't specify the destination host which you want to connect to through the SOCKS server. I've used google.com on port 80 in this example.

socat TCP-LISTEN:1234,fork SOCKS4A:127.0.0.1:google.com:80,socksport=5678

The TCP-LISTEN address is the port to listen on for connections from the .NET application. 1234 is obviously the port number, and the fork option allows multiple connections to me made. The SOCKS4A address is the SOCKS server and destination host to connect to. (If you don't want the SOCKS server to do DNS resolution change SOCKS4A to SOCKS4.) 127.0.0.1 is the address of the SOCKS server, and the socksport option specifies the port of the SOCKS server. google.com:80 is the destination host and port to ask the SOCKS server to connect to.

share|improve this answer
    
This is the part thats confusing me. My .NET app should be able to visit google, yahoo, SO or any other site. Which is why it didnt make sense to set google.com:80 bc now it seems like no matter what site i want to visit it will always go to google? I want to say .NET use 127.0.0.1:1234, its a SOCKS proxy that sits at 127.0.0.1:5678 and it will let you go whereever you want. (dns resolution on the socks proxy). What is the command to do that? –  acidzombie24 Jul 13 '12 at 13:16
    
@acidzombie24 In that case your app needs to understand that there's a proxy there and actually talk to the proxy. socat can't magically know where the app wants to connect to. –  mgorven Jul 13 '12 at 16:28
    
Thats fine and all but my app DOES know where to connect to. However how do i tell socat that info? I figured it out but w/o using socat. I wrote my own SOCKS code. It was time consuming :x –  acidzombie24 Jul 13 '12 at 16:31
    
@acidzombie24 Your app knows, but it needs to tell the proxy that, which means that you need a protocol between the app and the proxy which can convey that information... like SOCKS. –  mgorven Jul 13 '12 at 18:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.