Esempio n. 1
0
 public void Init(byte[] pData, int bufSize)
 {
     if ((pData != null) && (bufSize > 0))
     {
         if (pSendData != null)
         {
             pSendData.Dispose();
         }
         pSendData = NetByteArrayPool.GetByteBufferNode(bufSize);
         Buffer.BlockCopy(pData, 0, pSendData.GetBuffer(), 0, bufSize);
     }
     else
     {
         pSendData = null;
     }
 }
Esempio n. 2
0
        public void SendCapnProto(CapnProtoMsg msg, int packetHandle)
        {
            ByteBufferNode node   = NetByteArrayPool.GetByteBufferNode();
            var            buffer = node.GetBuffer();

            System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer);
            msg.WriteToStream(stream);
            Send(buffer, packetHandle, (int)stream.Position);
            stream.Dispose();
            node.Dispose();
        }