public void Disconnect(ProxyClient client) { lock (Clients) { Clients.Remove(client); } }
private void OnAccept(object sender, SocketAsyncEventArgs e) { if (e.SocketError != SocketError.Success) { // 소켓 에러 발생시 더 이상 listen 하지 않음 return; } var clientSocket = e.AcceptSocket; var handler = new ProxyClient(clientSocket, this); handler.StartWorkerThread(); lock (Clients) { Clients.Add(handler); } e.AcceptSocket = null; Listener.AcceptAsync(e); }
public static void RunWorker(object state) { ProxyClient client = state as ProxyClient; client.Worker(); }