Relays data between a remote host and a local client, using the SOCKS protocols.
This class implements the SOCKS4, SOCKS4a and SOCKS5 protocols. If the MustAuthenticate property is set, only SOCKS5 connections are allowed and the AuthList parameter of the constructor should not be null.
Inheritance: Org.Mentalis.Proxy.Client
Example #1
0
	///<summary>Called when there's an incoming client connection waiting to be accepted.</summary>
	///<param name="ar">The result of the asynchronous operation.</param>
	public override void OnAccept(IAsyncResult ar) {
		try {
			Socket NewSocket = ListenSocket.EndAccept(ar);
			if (NewSocket != null) {
				SocksClient NewClient = new SocksClient(NewSocket, new DestroyDelegate(this.RemoveClient), AuthList);
				AddClient(NewClient);
				NewClient.StartHandshake();
			}
		} catch {}
		try {
			//Restart Listening
			ListenSocket.BeginAccept(new AsyncCallback(this.OnAccept), ListenSocket);
		} catch {
			Dispose();
		}
	}
Example #2
0
 ///<summary>Called when there's an incoming client connection waiting to be accepted.</summary>
 ///<param name="ar">The result of the asynchronous operation.</param>
 public override void OnAccept(IAsyncResult ar)
 {
     try {
         Socket NewSocket = ListenSocket.EndAccept(ar);
         if (NewSocket != null)
         {
             SocksClient NewClient = new SocksClient(NewSocket, new DestroyDelegate(this.RemoveClient), AuthList);
             AddClient(NewClient);
             NewClient.StartHandshake();
         }
     } catch {}
     try {
         //Restart Listening
         ListenSocket.BeginAccept(new AsyncCallback(this.OnAccept), ListenSocket);
     } catch {
         Dispose();
     }
 }