ResolveHost() public static méthode

public static ResolveHost ( string hostName ) : string
hostName string
Résultat string
        public bool MoveNext()
        {
            uint num = (uint)this.SPC;

            this.SPC = -1;
            switch (num)
            {
            case 0:
                this.region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing;
                this.f__this.PingsRunning++;
                if (PhotonHandler.PingImplementation != typeof(PingNativeDynamic))
                {
                    this.ping__0 = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation);
                    break;
                }
                UnityEngine.Debug.Log("Using constructor for new PingNativeDynamic()");
                this.ping__0 = new PingNativeDynamic();
                break;

            case 1:
                return(GotoOne());   //goto Label_01B9;

            //break;

            case 2:
                GotoTwo();    //goto Label_0268;
                break;

            case 3:
                this.SPC = -1;
                goto Label_02B3;

            default:
                goto Label_02B3;
            }
            this.rttSum__1          = 0f;
            this.replyCount__2      = 0;
            this.cleanIpOfRegion__3 = this.region.HostAndPort;
            this.indexOfColon__4    = this.cleanIpOfRegion__3.LastIndexOf(':');
            if (this.indexOfColon__4 > 1)
            {
                this.cleanIpOfRegion__3 = this.cleanIpOfRegion__3.Substring(0, this.indexOfColon__4);
            }
            this.cleanIpOfRegion__3 = PhotonPingManager.ResolveHost(this.cleanIpOfRegion__3);
            this.i__5 = 0;
            while (this.i__5 < PhotonPingManager.Attempts)
            {
                this.overtime__6 = false;
                this.sw__7       = new Stopwatch();
                this.sw__7.Start();
                try
                {
                    this.ping__0.StartPing(this.cleanIpOfRegion__3);
                }
                catch (Exception exception)
                {
                    this.e__8 = exception;
                    UnityEngine.Debug.Log("catched: " + this.e__8);
                    this.f__this.PingsRunning--;
                    break;
                }

                /*Label_01B9:
                 *  while (!this.ping__0.Done())
                 *  {
                 *      if (this.sw__7.ElapsedMilliseconds >= PhotonPingManager.MaxMilliseconsPerPing)
                 *      {
                 *          this.overtime__6 = true;
                 *          break;
                 *      }
                 *      this.Scurrent = 0;
                 *      this.SPC = 1;
                 *      goto Label_02B5;
                 *  }
                 *  this.rtt__9 = (int) this.sw__7.ElapsedMilliseconds;
                 *  if ((!PhotonPingManager.IgnoreInitialAttempt || (this.i__5 != 0)) && (this.ping__0.Successful && !this.overtime__6))
                 *  {
                 *      this.rttSum__1 += this.rtt__9;
                 *      this.replyCount__2++;
                 *      this.region.Ping = (int) (this.rttSum__1 / ((float) this.replyCount__2));
                 *  }
                 *  this.Scurrent = new WaitForSeconds(0.1f);
                 *  this.SPC = 2;*/
                //goto Label_02B5;
                //Label_0268:
                //this.i__5++;
            }
            this.f__this.PingsRunning--;
            this.Scurrent = null;
            this.SPC      = 3;
            goto Label_02B5;
Label_02B3:
            return(false);

Label_02B5:
            return(true);
        }
Exemple #2
0
        public bool MoveNext()
        {
            uint num = (uint)this.SPC;

            this.SPC = -1;
            switch (num)
            {
            case 0:
                this.region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing;
                this.fthis.PingsRunning++;
                if (PhotonHandler.PingImplementation != typeof(PingNativeDynamic))
                {
                    this.ping0 = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation);
                    break;
                }
                UnityEngine.Debug.Log("Using constructor for new PingNativeDynamic()");
                this.ping0 = new PingNativeDynamic();
                break;

            case 1:
            //goto Label_01B9;

            case 2:
            //goto Label_0265;

            case 3:
                this.SPC = -1;
                goto Label_02B0;

            default:
                goto Label_02B0;
            }
            this.rttSum1          = 0f;
            this.replyCount2      = 0;
            this.cleanIpOfRegion3 = this.region.HostAndPort;
            this.indexOfColon4    = this.cleanIpOfRegion3.LastIndexOf(':');
            if (this.indexOfColon4 > 1)
            {
                this.cleanIpOfRegion3 = this.cleanIpOfRegion3.Substring(0, this.indexOfColon4);
            }
            this.cleanIpOfRegion3 = PhotonPingManager.ResolveHost(this.cleanIpOfRegion3);
            this.i5 = 0;
            while (this.i5 < PhotonPingManager.Attempts)
            {
                this.overtime6 = false;
                this.sw7       = new Stopwatch();
                this.sw7.Start();
                try
                {
                    this.ping0.StartPing(this.cleanIpOfRegion3);
                }
                catch (Exception exception)
                {
                    this.e8 = exception;
                    UnityEngine.Debug.Log("catched: " + this.e8);
                    this.fthis.PingsRunning--;
                    break;
                }
Label_01B9:
                while (!this.ping0.Done())
                {
                    if (this.sw7.ElapsedMilliseconds >= PhotonPingManager.MaxMilliseconsPerPing)
                    {
                        this.overtime6 = true;
                        break;
                    }
                    this.Scurrent = 0;
                    this.SPC      = 1;
                    goto Label_02B2;
                }
                this.rtt9 = (int)this.sw7.ElapsedMilliseconds;
                if ((!PhotonPingManager.IgnoreInitialAttempt || (this.i5 != 0)) && (this.ping0.Successful && !this.overtime6))
                {
                    this.rttSum1 += this.rtt9;
                    this.replyCount2++;
                    this.region.Ping = (int)(this.rttSum1 / ((float)this.replyCount2));
                }
                this.Scurrent = new WaitForSeconds(0.1f);
                this.SPC      = 2;
                goto Label_02B2;
Label_0265:
                this.i5++;
            }
            this.fthis.PingsRunning--;
            this.Scurrent = null;
            this.SPC      = 3;
            goto Label_02B2;
Label_02B0:
            return(false);

Label_02B2:
            return(true);
        }
    // Token: 0x06003DFA RID: 15866 RVA: 0x00138614 File Offset: 0x00136A14
    public IEnumerator PingSocket(Region region)
    {
        region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing;
        this.PingsRunning++;
        PhotonPing ping;

        if (PhotonHandler.PingImplementation == typeof(PingNativeDynamic))
        {
            UnityEngine.Debug.Log("Using constructor for new PingNativeDynamic()");
            ping = new PingNativeDynamic();
        }
        else if (PhotonHandler.PingImplementation == typeof(PingMono))
        {
            ping = new PingMono();
        }
        else
        {
            ping = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation);
        }
        float  rttSum        = 0f;
        int    replyCount    = 0;
        string regionAddress = region.HostAndPort;
        int    indexOfColon  = regionAddress.LastIndexOf(':');

        if (indexOfColon > 1)
        {
            regionAddress = regionAddress.Substring(0, indexOfColon);
        }
        regionAddress = PhotonPingManager.ResolveHost(regionAddress);
        for (int i = 0; i < PhotonPingManager.Attempts; i++)
        {
            bool      overtime = false;
            Stopwatch sw       = new Stopwatch();
            sw.Start();
            try
            {
                ping.StartPing(regionAddress);
            }
            catch (Exception arg)
            {
                UnityEngine.Debug.Log("catched: " + arg);
                this.PingsRunning--;
                break;
            }
            while (!ping.Done())
            {
                if (sw.ElapsedMilliseconds >= (long)PhotonPingManager.MaxMilliseconsPerPing)
                {
                    overtime = true;
                    break;
                }
                yield return(0);
            }
            int rtt = (int)sw.ElapsedMilliseconds;
            if (!PhotonPingManager.IgnoreInitialAttempt || i != 0)
            {
                if (ping.Successful && !overtime)
                {
                    rttSum += (float)rtt;
                    replyCount++;
                    region.Ping = (int)(rttSum / (float)replyCount);
                }
            }
            yield return(new WaitForSeconds(0.1f));
        }
        this.PingsRunning--;
        yield return(null);

        yield break;
    }
Exemple #4
0
    // Token: 0x0600050B RID: 1291 RVA: 0x0001DC5F File Offset: 0x0001BE5F
    public IEnumerator PingSocket(Region region)
    {
        region.Ping = PhotonPingManager.Attempts * PhotonPingManager.MaxMilliseconsPerPing;
        this.PingsRunning++;
        PhotonPing ping = null;

        if (PhotonHandler.PingImplementation == typeof(PingMono))
        {
            ping = new PingMono();
        }
        if (ping == null)
        {
            ping = (PhotonPing)Activator.CreateInstance(PhotonHandler.PingImplementation);
        }
        float  rttSum        = 0f;
        int    replyCount    = 0;
        string regionAddress = region.HostAndPort;
        int    num           = regionAddress.LastIndexOf(':');

        if (num > 1)
        {
            regionAddress = regionAddress.Substring(0, num);
        }
        int num2 = regionAddress.IndexOf("wss://");

        if (num2 > -1)
        {
            regionAddress = regionAddress.Substring(num2 + "wss://".Length);
        }
        regionAddress = PhotonPingManager.ResolveHost(regionAddress);
        int i = 0;

        while (i < PhotonPingManager.Attempts)
        {
            bool      overtime = false;
            Stopwatch sw       = new Stopwatch();
            sw.Start();
            try
            {
                ping.StartPing(regionAddress);
                goto IL_1BC;
            }
            catch (Exception arg)
            {
                Debug.Log("catched: " + arg);
                this.PingsRunning--;
                break;
            }
            goto IL_184;
IL_1C9:
            int num3 = (int)sw.ElapsedMilliseconds;
            int num4;
            if ((!PhotonPingManager.IgnoreInitialAttempt || i != 0) && ping.Successful && !overtime)
            {
                rttSum     += (float)num3;
                num4        = replyCount;
                replyCount  = num4 + 1;
                region.Ping = (int)(rttSum / (float)replyCount);
            }
            yield return(new WaitForSeconds(0.1f));

            sw   = null;
            num4 = i;
            i    = num4 + 1;
            continue;
IL_184:
            if (sw.ElapsedMilliseconds >= (long)PhotonPingManager.MaxMilliseconsPerPing)
            {
                overtime = true;
                goto IL_1C9;
            }
            yield return(0);

IL_1BC:
            if (ping.Done())
            {
                goto IL_1C9;
            }
            goto IL_184;
        }
        ping.Dispose();
        this.PingsRunning--;
        yield return(null);

        yield break;
    }