private void TcpDataReceived(TcpConnection source, TcpDataReceivedEventArgs e) { switch (JsonConvert.DeserializeObject<RequestModel>(e.Data).Action) { } }
private void TcpAccept(IAsyncResult ar) { var socket = new TcpConnection(TcpListener.EndAcceptSocket(ar)); socket.DataReceived += TcpDataReceived; socket.ConnectionClosed += (o, e) => { Connections.Remove((TcpConnection)o); }; Connections.Add(socket); }