Beispiel #1
0
        // 获取数据,然后压缩加密
        public void getSocketSendData()
        {
            //m_socketSendBA.m_startTest = false;

            m_socketSendBA.clear();

            // 获取完数据,就解锁
            #if NET_MULTHREAD
            using (MLock mlock = new MLock(m_writeMutex))
            #endif
            {
                //m_socketSendBA.writeBytes(m_sendTmpBA.dynBuff.buff, 0, (uint)m_sendTmpBA.length);
                //m_sendTmpBA.clear();
                // 一次全部取出来发送出去
                //m_socketSendBA.writeBytes(m_sendTmpBuffer.circuleBuffer.buff, 0, (uint)m_sendTmpBuffer.circuleBuffer.size);
                //m_sendTmpBuffer.circuleBuffer.clear();
                // 一次仅仅获取一个消息发送出去,因为每一个消息的长度要填写加密补位后的长度
                if (m_sendTmpBuffer.popFront())                                                                             // 弹出一个消息,如果只有一个消息,内部会重置变量
                {
                    m_socketSendBA.writeBytes(m_sendTmpBuffer.headerBA.dynBuff.buff, 0, m_sendTmpBuffer.headerBA.length);   // 写入头
                    m_socketSendBA.writeBytes(m_sendTmpBuffer.msgBodyBA.dynBuff.buff, 0, m_sendTmpBuffer.msgBodyBA.length); // 写入消息体
                }
            }

#if MSG_COMPRESS || MSG_ENCRIPT
            m_socketSendBA.setPos(0);
            CompressAndEncryptEveryOne();
            // CompressAndEncryptAllInOne();
#endif
            m_socketSendBA.position = 0;        // 设置指针 pos

            //m_socketSendBA.m_startTest = true;
        }
Beispiel #2
0
 public void moveRaw2Msg()
 {
     while (m_rawBuffer.popFront())  // 如果有数据
     {
         //UnCompressAndDecryptAllInOne();
         UnCompressAndDecryptEveryOne();
     }
 }
Beispiel #3
0
        public ByteBuffer getMsg()
        {
            #if NET_MULTHREAD
            using (MLock mlock = new MLock(m_readMutex))
            #endif
            {
                if (m_msgBuffer.popFront())
                {
                    return(m_msgBuffer.msgBodyBA);
                }
            }

            return(null);
        }