It is completely written in managed code (C#) and is compliant with Common Language Specification (CLS), so it can be used with any other .NET language too, including Visual Basic (VB.NET), C++/CLI, J#, IronPython, IronRuby, F# and PowerShell.
ProxyClient.NET offers an easy way to traverse firewalls, using proxy servers, from within your applications; it can quickly make outgoing TCP connections to SOCKS v4, SOCKS v4A, SOCKS v5 and HTTP-CONNECT proxy servers, either by automatically creating a new socket (or a TcpClient instance) or by using a supplied object of this type, allowing you to even construct and configure it externally. The component has no restrictions on the kind of transferred data and supports both asynchronous and synchronous connections.
Here is, for example, how you could send a simple HTTP request to a remote web server via a SOCKS5 proxy server using a raw socket:
// Set up a new proxy client object, bound to the specified SOCKS5 server
var proxy = new Socks5Proxy(IPAddress.Parse("10.0.1.2"),
"john",
"$ecrEt");
// Connect to the target IP endpoint via the proxy server
var targetEndPoint = new IPEndPoint(IPAddress.Parse("65.55.12.249"), 80);
using (var socket = proxy.Connect(targetEndPoint))
{
// TODO: Use the newly-created socket
socket.Send(Encoding.ASCII.GetBytes("GET / HTTP/1.1\n"));
// ...
}
ProxyClient.NET shares the same naming conventions and style you may find in the .NET framework itself and exposes a clean object hierarchy; connecting to a proxy server from within your own application, being it an ASP.NET website, a Windows Forms or a WPF application, requires just a line of code in most scenarios.
Should you need to connect to a remote FTP server using your company HTTP proxy server, for example, while using a TcpClient object, your code would look like this:
// Set up a new proxy client, bound to the specified HTTP-Connect server
var proxyEndPoint = new IPEndPoint(IPAddress.Parse("10.0.1.2"), 8080);
var proxy = new HttpConnectProxy(proxyEndPoint,
"john",
"$ecrEt");
// Connect to the target FTP server via the proxy server
var targetEndPoint = new IPEndPoint(IPAddress.Parse("64.4.30.62"), 21);
using (var tcpClient = proxy.ConnectTcpClient(targetEndPoint))
using (var ftpStream = tcpClient.GetStream())
using (var srFtpClient = new StreamReader(ftpStream))
{
// Retrieve the welcome message from the remote FTP server
var welcomeMessage = srFtpClient.ReadLine();
// ...
}