コード例 #1
0
ファイル: PortMapListener.cs プロジェクト: Wenqihai/Proxy
	///<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) {
				PortMapClient NewClient = new PortMapClient(NewSocket, new DestroyDelegate(this.RemoveClient), MapTo);
				AddClient(NewClient);
				NewClient.StartHandshake();
			}
		} catch {}
		try {
			//Restart Listening
			ListenSocket.BeginAccept(new AsyncCallback(this.OnAccept), ListenSocket);
		} catch {
			Dispose();
		}
	}
コード例 #2
0
ファイル: PortMapListener.cs プロジェクト: radtek/SharpProxy
 ///<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)
         {
             PortMapClient NewClient = new PortMapClient(NewSocket, new DestroyDelegate(this.RemoveClient), MapTo);
             AddClient(NewClient);
             NewClient.StartHandshake();
         }
     } catch {}
     try {
         //Restart Listening
         ListenSocket.BeginAccept(new AsyncCallback(this.OnAccept), ListenSocket);
     } catch {
         Dispose();
     }
 }