Click here to Skip to main content
13,297,799 members (47,916 online)
Click here to Skip to main content
Add your own
alternative version


45 bookmarked
Posted 26 Jan 2004

C# class for connecting via a SOCKS5 Proxy Server

, 26 Jan 2004
Rate this:
Please Sign up or sign in to vote.
C# class for connecting via a SOCKS5 Proxy Server


The download contains a C# source file that defines a SocksProxy class. This class can be used by the hosts, which are behind a firewall to connect to the outside world.


When a TCP-based client wishes to establish a connection to an object that is reachable only via a firewall and that firewall speaks SOCKS5 protocol, this class can used on the client side to reach the object via firewall. The SOCKS service is conventionally located on TCP port 1080.

This class provides only a single static method named ConnectToSocks5Proxy, which accepts required arguments and returns a socket connected to the destination endpoint. If something wrong happens, it throws a ConnectionException. This version only supports "connect" command. "Bind" and "UDP" is not supported in this version.

For details about SOCKS5 RFC visit:

Client usage

Socket client;
client = LMKR.SocksProxy.ConnectToSocks5Proxy(
string strGet = "GET //\r\n";


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Pakistan Pakistan
I started programming in 1996 with Lotus 123 (macro's). From that day programming became my life partner.

Currently I live in Rawalpindi, Pakistan.

You may also be interested in...


Comments and Discussions

QuestionRegarding license terms and conditions for the SOCKS5 proxy implementation. Pin
Member 1341981426-Sep-17 4:14
memberMember 1341981426-Sep-17 4:14 
Question不能用。。 Pin
songgongpu26-Sep-13 23:59
membersonggongpu26-Sep-13 23:59 
QuestionProxy Access with authentication Pin
paras d. patel1-May-13 21:09
memberparas d. patel1-May-13 21:09 
QuestionUDP Support Pin
seer_tenedos229-Nov-11 16:07
memberseer_tenedos229-Nov-11 16:07 
GeneralIt does't work Pin
popsickle12-Oct-09 16:14
memberpopsickle12-Oct-09 16:14 
I have a proxy server that supports only the method "no authentication". But the class is providing an empty user name and an empty password forgetting the server's reply. It returns "Invalid User name/password". I've tried to remove this part of the class by adding a condition when the user name is empty. No more success, I get "General Socket Error". I don't know what to tell to the proxy when it accepts a "no authentication" communication method. And the rfc specifitions are very hard to find through google. I don't know what to do else. Maybe install a sniffer between a working software and my proxy server.
Generalbug in his proxyserver Pin
edvo13-Feb-06 9:53
memberedvo13-Feb-06 9:53 
GeneralRe: bug in his proxyserver Pin
Member 119906661-Dec-15 3:38
memberMember 119906661-Dec-15 3:38 
GeneralUDP Proxy Pin
keshavcn9-Sep-05 22:13
memberkeshavcn9-Sep-05 22:13 
QuestionHow to make http proxy connection Pin
sangram120-Jul-05 5:20
membersangram120-Jul-05 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 27 Jan 2004
Article Copyright 2004 by ZAhmed
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid