Click here to Skip to main content
Licence 
First Posted 26 Jan 2004
Views 89,208
Bookmarked 39 times

C# class for connecting via a SOCKS5 Proxy Server

By | 26 Jan 2004 | Article
C# class for connecting via a SOCKS5 Proxy Server

Introduction

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.

Description

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: http://www.faqs.org/rfcs/rfc1928.html

Client usage

Socket client;
client = LMKR.SocksProxy.ConnectToSocks5Proxy(
  "172.16.64.145",1080,"www.microsoft.com",
  80,"U$er","Pa$$word!");
string strGet = "GET //\r\n";
s.Send(System.Text.Encoding.ASCII.GetBytes(strGet));

License

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

ZAhmed

Web Developer

Pakistan Pakistan

Member

I started programming in 1996 with Lotus 123 (macro's). From that day programming became my life partner.
 
Currently I live in Rawalpindi, Pakistan.
 


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionUDP Support Pinmemberseer_tenedos215:07 29 Nov '11  
GeneralIt does't work Pinmemberpopsickle15:14 12 Oct '09  
GeneralRe: It does't work [Solution] Pinmembersupersven19863:41 7 Jun '10  
Generalbug in his proxyserver Pinmemberedvo8:53 13 Feb '06  
GeneralUDP Proxy Pinmemberkeshavcn21:13 9 Sep '05  
QuestionHow to make http proxy connection Pinmembersangram14:20 20 Jul '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120517.1 | Last Updated 27 Jan 2004
Article Copyright 2004 by ZAhmed
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid