Пример #1
0
 public Boolean SendPacket(OutPacket oPacket)
 {
     try
     {
         if (_socket.Connected)
         {
             // packet을 보낸다.
             NetworkStream stream = _socket.GetStream();
             Byte[] data = oPacket.BufBytes.ToArray();
             stream.BeginWrite(data, 0, data.Length, TcpSessionAsync.WriteCallBack, this);
             return true;
         }
         else
         {
             logger.Warn("socket is closed.");
             return false;
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.ToString());
     }
     return false;
 }
Пример #2
0
        public InPacket Communicate(OutPacket oPacket)
        {
            NetworkStream stream = _socket.GetStream();

            Byte[] outData = oPacket.BufBytes.ToArray();
            stream.Write(outData, 0, outData.Length);

            int inCount = stream.Read(_inData, 0, _maxPacketSize);

            InPacket iPacket = new InPacket();
            iPacket.ForcedEncode(_inData, inCount);
            return iPacket;
        }
Пример #3
0
 public InPacket(OutPacket oPacket)
 {
     List<Byte> aBuf = oPacket.BufBytes;
     _aBuf_Bytes.AddRange(aBuf);
 }