Exemplo n.º 1
0
        void UdpHandler()
        {
            IPEndPoint _toEndPoint = new IPEndPoint(IPAddress.Any, 0);

            byte[] data = _myUdpClient.Receive(ref _toEndPoint);

            AR_InfoHead reciveHead = InfoAnalyze.GetInfoHead(data);

            //收到,发送反馈包
            byte[] feedback = InfoAnalyze.GetFeedbackBytes(reciveHead);
            _myUdpClient.Send(feedback, feedback.Length, _toEndPoint);

            //组织各种包数据 - 发送
            if (reciveHead.TaskNum < 30)
            {
                //任务码10:人员信息 //任务码15:赛程安排 //任务码20:站位表
                int    phaseId  = InfoAnalyze.GetReceiveInt32(data);//默认为0
                byte[] sendData = InfoAnalyze.GetSendBytes(reciveHead, phaseId);
                _myUdpClient.Send(sendData, sendData.Length, _toEndPoint);
            }
            else if (reciveHead.TaskNum == 30)// &&CurMatchInfo.MatchStatusID == 50) // 接收成绩数据
            {
                InfoAnalyze.InsertArrowResultToOvr(data);
            }
            else if (reciveHead.TaskNum == 31)// && CurMatchInfo.MatchStatusID == 50) // 接收附加赛成绩数据
            {
                InfoAnalyze.InsertArrowShootOffToOvr(data);
            }
        }
Exemplo n.º 2
0
        public static byte[] GetSendBytes(AR_InfoHead head, int para)
        {
            AR_InfoHead sendHead = new AR_InfoHead();

            sendHead.HeadMark    = head.HeadMark;
            sendHead.EndMark     = head.EndMark;
            sendHead.ConfirmMark = head.ConfirmMark;
            sendHead.TaskNum    += head.TaskNum + 1;
            string strData = string.Empty;

            switch (head.TaskNum)
            {
            case 10:
                strData = GVAR.g_ManageDB.InterfaceGetRegisterInfo(GVAR.g_strDisplnCode);
                break;

            case 15:
                strData = GVAR.g_ManageDB.InterfaceGetScheduleInfo(GVAR.g_strDisplnCode);
                break;

            case 20:
                strData = GVAR.g_ManageDB.InterfaceGetMatchStartList(para);
                break;
            }
            byte[] dataBytes = Encoding.UTF8.GetBytes(strData);
            sendHead.InfoLength = dataBytes.Length;
            byte[] sendData = InfoAnalyze.GetPackageBytes(sendHead, dataBytes);

            return(sendData);
        }