Beispiel #1
0
 private async Task SendOutcomingPacket(UncompressedPacket packet)
 {
     if (_useCompression)
     {
         var newPacket = PacketCompress.Compress(ref packet);
         await newPacket.SerializeAsync(_remoteStream);
     }
     else
     {
         await packet.SerializeAsync(_remoteStream);
     }
 }
Beispiel #2
0
 private async Task SendOutcomingPacket(UncompressedPacket packet)
 {
     // Close
     if (packet == null)
     {
         _tcpClient.Client.Shutdown(SocketShutdown.Send);
         _outcomingPacketDispatcher.Complete();
     }
     else if (_useCompression)
     {
         var newPacket = PacketCompress.Compress(ref packet);
         await newPacket.SerializeAsync(_remoteStream);
     }
     else
     {
         await packet.SerializeAsync(_remoteStream);
     }
 }