Beispiel #1
0
 /// <summary>
 /// 添加客户端
 /// </summary>
 /// <param name="client">客户端</param>
 internal void AddClient(Socks5Client client)
 {
     if (_Clients.IndexOf(client) == -1)
     {
         _Clients.Add(client);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 异步接收处理新连接的客户端
 /// </summary>
 /// <param name="ar"></param>
 private void OnAccept(IAsyncResult ar)
 {
     try
     {
         var NewSocket = _ListenSocket.EndAccept(ar);
         if (NewSocket != null)
         {
             var NewClient = new Socks5Client(NewSocket, new DestroyDelegate(this.DelClient), _AuthList, ref Log);
             AddClient(NewClient);
             NewClient.StartHandshake();
         }
     } catch (Exception ex) { Log.AddLog("新客户端接入处理时出错|" + ex.Message); }
     try { _ListenSocket.BeginAccept(new AsyncCallback(this.OnAccept), _ListenSocket); }
     catch (Exception ex) { Log.AddLog("新客户端接入处理时出错2|" + ex.Message); Dispose(); }
 }
Beispiel #3
0
 /// <summary>
 /// 删除客户端
 /// </summary>
 /// <param name="client">客户端</param>
 internal void DelClient(Socks5Client client)
 {
     _Clients.Remove(client);
 }