예제 #1
0
파일: IceClient.cs 프로젝트: ForNeVeR/pnet
        // Form message header, which is ICE's own header + user generated header
        // Caller is guilty for user header bytesex
        protected void SendHeader(byte[] header, int length)
        {
            if (!messageTransaction)
            {
                throw new XInvalidOperationException("Can not send header until not started message");
            }

            int headerLength = header.Length;
            int size         = 8 + headerLength;

            byte[] buffer = new byte[size];
            buffer[0] = (byte)majorOpcode;
            buffer[1] = (byte)minorOpcode;
            buffer[2] = (byte)0;
            buffer[3] = (byte)0;
            if (ICE.IsLittleEndian)
            {
                buffer[4] = (byte)length;                        //(byte)size;
                buffer[5] = (byte)(length >> 8);
                buffer[6] = (byte)(length >> 16);
                buffer[7] = (byte)(length >> 24);
            }
            else
            {
                buffer[4] = (byte)(length >> 24);
                buffer[5] = (byte)(length >> 16);
                buffer[6] = (byte)(length >> 8);
                buffer[7] = (byte)length;
            }
            Array.Copy(header, 0, buffer, 8, headerLength);
            ICE.IceFlush(iceConn);
            ICE._IceWrite(iceConn, (Xlib.Xulong)size, buffer);
        }
예제 #2
0
파일: IceClient.cs 프로젝트: ForNeVeR/pnet
        protected void SendData(byte[] data)
        {
            if (!messageTransaction)
            {
                throw new XInvalidOperationException("Can not send data until not started message");
            }

            ICE.IceFlush(iceConn);
            ICE._IceWrite(iceConn, (Xlib.Xulong)data.Length, data);                     // If someone want to send part of buffer he should fsck with it himself
        }