Пример #1
0
        private void handleUDPData(byte[] data)
        {
            foreach (MySocket socket in tcpSockets)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(send4ThreadPool), new Object4Send(data, socket));
            }
            VFHead head = VFHead.readBytes(BytesUtil.subBytes(data, 0, VFHead.LENGTH));

            if (head.FrameOrder < curFrameOrder)
            {
                return;
            }
            if (head.FrameOrder > curFrameOrder)
            {
                curFrameOrder = head.FrameOrder;
                buffer        = new FramePart[head.PartsNum];
                isfull        = new bool[head.PartsNum];
            }
            if (buffer.Length != head.PartsNum)
            {
                return;
            }
            buffer[head.PartOrder] = new FramePart(BytesUtil.subBytes(data, VFHead.LENGTH));
            isfull[head.PartOrder] = true;
            if (ifFull(isfull))
            {
                videoFrameHandler.Invoke(BytesUtil.bytes2Bitmap(BytesUtil.FrameParts2Bytes(buffer)));
            }
        }
Пример #2
0
        private void handleUDPData(byte[] data)
        {
            VFHead head = VFHead.readBytes(BytesUtil.subBytes(data, 0, VFHead.LENGTH));

            if (head.FrameOrder < curFrameOrder)
            {
                return;
            }
            if (head.FrameOrder > curFrameOrder)
            {
                curFrameOrder = head.FrameOrder;
                buffer        = new FramePart[head.PartsNum];
                isfull        = new bool[head.PartsNum];
            }
            if (buffer.Length != head.PartsNum)
            {
                return;
            }
            buffer[head.PartOrder] = new FramePart(BytesUtil.subBytes(data, VFHead.LENGTH));
            isfull[head.PartOrder] = true;
            if (ifFull(isfull))
            {
                videoFrameHandler.Invoke(BytesUtil.bytes2Bitmap(BytesUtil.FrameParts2Bytes(buffer)));
            }
        }
Пример #3
0
        private void handleTCPData(MySocket mySocket, byte[] data)
        {
            byte[] CRPData = BytesUtil.subBytes(data, CRPHead.length);
            byte[] head    = BytesUtil.subBytes(data, 0, CRPHead.length);
            switch (checkDataType(head))
            {
            case CRPHead.REQUEST_LOGIN:
                handleLogin(mySocket, CRPData);
                break;

            case CRPHead.REQUEST_LOGOUT:
                handleLogout(mySocket, CRPData);
                break;

            case CRPHead.SEND_MESSAGE:
                handleMessage(mySocket, CRPData);
                break;

            case CRPHead.SEND_PICTURE:
                handlePicture(mySocket, CRPData);
                break;

            case CRPHead.REQUEST_VIDEO_START:
                handleVideoStart(mySocket, CRPData);
                break;

            case CRPHead.REQUEST_VIDEO_STOP:
                handleVideoStop(mySocket, CRPData);
                break;
            }
        }
Пример #4
0
        private void handleTCPData(byte[] data)
        {
            byte[] CRPData = BytesUtil.subBytes(data, CRPHead.LENGTH);
            byte[] head    = BytesUtil.subBytes(data, 0, CRPHead.LENGTH);
            switch (checkDataType(head))
            {
            case CRPHead.RESPONSE_LOGIN:
                handleLogin(CRPData);
                break;

            case CRPHead.FORWARD_MESSAGE:
                handleMessage(CRPData);
                break;

            case CRPHead.FORWARD_PICTURE:
                handlePicture(CRPData);
                break;

            case CRPHead.RESPONSE_VIDEO_START:
                handleVideoStart(CRPData);
                break;
            }
        }