コード例 #1
0
 public async Task SendPacket(IStreamable packet, IPEndPoint recipient)
 {
     using (MemoryStream memStream = new MemoryStream(new byte[152]))
         using (BinaryWriter writer = new BinaryWriter(memStream))
         {
             packet.WriteToStream(writer);
             var bytePacket = memStream.ToArray();
             await _client.SendAsync(bytePacket, bytePacket.Length, recipient);
         }
 }
コード例 #2
0
 public static void Write(IStreamable data, Stream stream)
 {
     data.WriteToStream(new BinaryWriter(stream));
 }