Example #1
0
 public bool Send(short msgType, QMessageBase msg)
 {
     _sendWriter.StartMessage(msgType);
     msg.Serialize(_sendWriter);
     _sendWriter.FinishMessage();
     NumMsgsOut++;
     return(SendWriter(_sendWriter));
 }
Example #2
0
        internal bool SendFragmentBytes(byte[] bytes, int bytesToSend)
        {
            var num = 0;

            while (bytesToSend > 0)
            {
                var num2  = Math.Min(bytesToSend, _maxPacketSize - 32);
                var array = new byte[num2];
                Array.Copy(bytes, num, array, 0, num2);
                _fragmentWriter.StartMessage(17);
                _fragmentWriter.Write(0);
                _fragmentWriter.WriteBytesFull(array);
                _fragmentWriter.FinishMessage();
                SendWriter(_fragmentWriter);
                num         += num2;
                bytesToSend -= num2;
            }
            _fragmentWriter.StartMessage(17);
            _fragmentWriter.Write(1);
            _fragmentWriter.FinishMessage();
            SendWriter(_fragmentWriter);
            return(true);
        }