예제 #1
0
 /// <summary>
 /// 处理接收的文本数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="datagram"></param>
 private void RaisePlaintextReceived(TcpClient sender, byte[] datagram)
 {
     PlaintextReceived?.Invoke(this,
                               new TcpDatagramReceivedEventArgs <string>(sender,
                                                                         this.Encoding.GetString(datagram, 0, datagram.Length))
                               );
 }
예제 #2
0
        private void RaisePlaintextReceived(TcpClient tcpClient, byte[] receivedBytes)
        {
            var str = this.Encoding.GetString(receivedBytes, 0, receivedBytes.Length);

            PlaintextReceived?.Invoke(this, new TcpDatagramReceivedEventArgs <string>(tcpClient,
                                                                                      this.Encoding.GetString(receivedBytes, 0, receivedBytes.Length)));
        }
예제 #3
0
 /// <summary>
 /// 接收数据报文明文事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="datagram"></param>
 private void OnPlaintextReceived(AsyncTCPClient sender, byte[] datagram)
 {
     PlaintextReceived?.Invoke(this, new TCPDatagramReceiveEventArgs <string>(
                                   sender, this.Encoding.GetString(datagram)));
 }