async public Task SendAsync(IPacket packet) { try { NetworkStream stream = this.client.GetStream(); // 1. 보낼 데이터를 압축한다. byte[] sendData = NetUtil.SerializeObject(data: packet); byte[] compressData = await NetUtil.CompressAsync(data : sendData); // 2. 요청의 헤더를 보낸다. int sendDataLength = compressData.Length; byte[] sendHeader = BitConverter.GetBytes(value: sendDataLength); await stream.WriteAsync(buffer : sendHeader, offset : 0, count : sendHeader.Length); // 3. 요청을 보낸다. await TcpUtil.SendDataAsync(networkStream : stream, data : compressData, dataLength : sendDataLength); await stream.FlushAsync(); } catch (Exception ex) { Console.WriteLine(ex); } }