/// <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)) ); }
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))); }
/// <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))); }