Ejemplo n.º 1
0
    public void RequestServerState()
    {
        string ipInfo = "127.0.0.1";// Config.GetUpdaterConfig("StateServerPath", "Value");

        if (string.IsNullOrEmpty(ipInfo))
        {
            //状态服务器地址没有配置/
            LogSystem.LogError("RequestServerState --> ipinfo not in config!");
            return;
        }

        string[] ipinfoStrs = UtilTools.Split(ipInfo, ':');
        if (ipinfoStrs.Length < 3)
        {
            LogSystem.LogError("RequestServerState -->ipinfo config Error");
            return;
        }

        ip       = ipinfoStrs[0];
        port     = UtilTools.IntParse(ipinfoStrs[1]);
        issuerId = UtilTools.IntParse(ipinfoStrs[2]);

        ServerStateSock sock = new ServerStateSock(OnTextSockConnected, OnTextSockConnectFailed, OnTextSockRecieveData);

        if (sock != null)
        {
            sock.Connect(ip, port);
        }
        dataIsReady = false;

        TimerManager.AddTimer("StateReqOverTime", 10f, StateReqListener);
        //#endif
    }