Пример #1
0
        public int Push(byte[] buffer, int size)
        {
            if (!Connected)
            {
                return(-1);
            }

            if (rc4Write != null) //发送前做rc4加密
            {
                rc4Write.Encrypt(buffer, size);
            }

            var headData = new byte[HeadLen];

            Helper.Int32ToByteArray(size, headData, 0);

            sendBuffer.PushData(headData, headData.Length);
            sendBuffer.PushData(buffer, buffer.Length);

            return(size + HeadLen);
        }
Пример #2
0
        public int PushBegin(int len)
        {
            if (!Connected)
            {
                return(-1);
            }

            var headData = new byte[HeadLen];

            Helper.Int32ToByteArray(len, headData, 0);

            sendBuffer.PushData(headData, headData.Length);

            return(HeadLen);
        }