How to add proxy support for connecting C # sockets?

I have a socket application that should support SOCKS 4 and 5 proxy connections, as my users may be behind firewalls. I am using WPF and C # 3.5 SP1. I do not see any parameters in the standard Socket class for proxies, do I need to roll it?

I would prefer not to use third-party libraries, if possible - how difficult is it to enable proxy support with standard C # Socket?

+3
source share
3 answers

This is not very difficult, but you should read a few RFCs. You need to read the RFC spec for Socks v4, Socks v4a and Socks v5. I wrote a library that will do all the work for you, but if you prefer to write your own, this is also cool. My library was mentioned in a previous post (Starksoft). You can implement the Socks protocol using a standard TcpClient object or a Socket connection. TcpClient is simpler. You just need to send commands immediately after connecting to your proxy server. This command instructs the proxy server to which endpoint you want to connect to. There are also specifications for connecting UDP Socks, but it looks like you won’t need it.

RFC . , stackoverflow , 1, . .

http://en.wikipedia.org/wiki/SOCKS

, , , MIT, .:) Socks4ProxyClient.cs, Socks v4. SendCommand(), 282. Google Code. Starksoft. -, Google.

Socks5 , Socks4.

, , . , , !

  • Benton
+2

google . Mentalis.org . - , , , - .

.

0

Source: https://habr.com/ru/post/1718681/


All Articles