private void Listen_Callback(IAsyncResult ar) { TcpListener s = (TcpListener)ar.AsyncState; TcpClient s2 = s.EndAcceptTcpClient(ar); SimpleTcpClient <T> stc = new SimpleTcpClient <T>(); stc.Socket = s2; stc.Disconnect += disconnect; stc.ReceivePacket += Switch; stc.ns = s2.GetStream(); stc.StartRecv(); Clients.Add(stc); OnClientComing?.Invoke(stc); s.BeginAcceptTcpClient(new AsyncCallback(Listen_Callback), s); }