コード例 #1
0
        public static FrameClass SendAndReceive(byte[] sendCommand, IPAddress checkIP, IPAddress ip, byte identifier, Batman batman)
        {
            DataListManger.ClearFrameClass(identifier);
            sendCommand[1] = identifier;
            IPEndPoint ipEndPoint = new IPEndPoint(ip, CommunicationClass.REMOTEPORT);

            batman.WorkSocket.SendTo(sendCommand, (EndPoint)ipEndPoint);
            Thread.Sleep(50);
            FrameClass revFrameClass = DataListManger.GetRevFrameClass(identifier, checkIP);
            int        num1          = 0;
            int        num2          = 200;

            while (revFrameClass == null && num1 < 6)
            {
                Thread.Sleep(num2 * ++num1);
                revFrameClass = DataListManger.GetRevFrameClass(identifier, checkIP);
                if (revFrameClass == null && num1 % 2 == 1)
                {
                    identifier     = Controller.GetNewCommandID();
                    sendCommand[1] = identifier;
                    batman.WorkSocket.SendTo(sendCommand, (EndPoint)ipEndPoint);
                }
            }
            DataListManger.ClearFrameClass(identifier);
            return(revFrameClass);
        }
コード例 #2
0
        public static FrameClass SendAndReceive(FrameClass sendCommand, Batman batman)
        {
            DataListManger.ClearFrameClass(sendCommand.Identifier);
            CommunicationClass.SendUdp(sendCommand, batman);
            Thread.Sleep(50);
            FrameClass revFrameClass = DataListManger.GetRevFrameClass(sendCommand.Identifier, sendCommand.IpAddr);
            int        num1          = 0;
            int        num2          = 200;

            while (revFrameClass == null && num1 < 6)
            {
                Thread.Sleep(num2 * ++num1);
                revFrameClass = DataListManger.GetRevFrameClass(sendCommand.Identifier, sendCommand.IpAddr);
                if (revFrameClass == null && num1 % 2 == 1)
                {
                    CommunicationClass.SendUdp(sendCommand, batman);
                }
            }
            DataListManger.ClearFrameClass(sendCommand.Identifier);
            return(revFrameClass);
        }