pcsms_0rExPLnF 发表于 2023-6-22 14:48:27

自动远程登陆,断线重连

//自动连接远程

//断线1分钟 重新连接

macro_command main()
        short Error,server,start,temp_a,status
        GetData(status, "Local HMI", LW, 10828, 1)        //读取状态
        GetData(Error, "Local HMI", LW, 10829, 1)   //读取错误代码
        GetData(start, "Local HMI", LW, 10820, 1)        //开始连接服务器
        GetData(server, "Local HMI", LW, 11296, 1)        //服务器地址
        GetData(temp_a, "Local HMI", LW, 80, 1)                //断线重连
       
        if status<>2 then
                start=1
                server=1
        end if
       
        if Error<>0 then
                start=0
        end if
       
        if start==0 then
                temp_a=temp_a+1
                if temp_a>6 then
                        start=1
                        server=1
                        temp_a=0
                end if
        end if
       
        SetData(server, "Local HMI", LW, 11296, 1)
        SetData(start, "Local HMI", LW, 10820, 1)
        SetData(temp_a, "Local HMI", LW, 80, 1)
       
end macro_command
页: [1]
查看完整版本: 自动远程登陆,断线重连