Wrong Best Region - Cloud

Hey,

After some tests I have noticed that my application connects to the US Photon Cloud server while using ConnectToBestCloudServer().
The problem is the US Server offers a lower ping than the EU one (I am in EUROPE: Toulouse, FRANCE).

For information, here are my GetPing() results for each region server:

On PC (Unity Editor):
EU > 70
US > 128
ASIA > 397
JP > 317

BEST connects to EU !

On MOBILE (Android: Galaxy Tab/Galaxy S & Galaxy S2):
EU > 80
US > 142
ASIA > 540
JP > 480

BEST connects to US !

Note: I'm using Wi-Fi on the mobile devices, connected to the same network than the computer.

PS: Any way to get the ping from a specific server ? I would like to display the ping aside the server region in the connection menu.

Comments

  • Currently, the auto-pinging is relatively rough. I don't know why it should connect to the wrong server though.
    Do you use the player-prefs-cached values maybe and they differ? How did you get the ping times? Debug log or some other way?

    At the moment, I can only invite you to modify the respective code in PUN, as we are busy on several fronts at the moment and I can't promise you an update soon.
  • Since Unity got a Ping method I have made a simple script to ping Photon Servers.

    Here it is:

    [code2=csharp]using UnityEngine;
    using System.Collections;

    public class PingPhoton : MonoBehaviour
    {
    #region Variables
    public delegate void PingDelegate(int ping);

    static private Hashtable Servers = new Hashtable();

    public enum Region {EU, US, JP, ASIA};
    #endregion

    static public IEnumerator PingRegion(Region region, PingDelegate callback)
    {
    Ping pong;

    string serverAddress = string.Format("app-{0}.exitgamescloud.com", region.ToString().ToLower());

    if(!Servers.ContainsKey(serverAddress))
    {
    string serverIP = PingCloudRegions.ResolveHost(serverAddress);
    Servers.Add(serverAddress, serverIP);
    pong = new Ping(serverIP);
    }
    else
    {
    pong = new Ping(Servers[serverAddress].ToString());
    }

    while (!pong.isDone)
    {
    yield return new WaitForSeconds(0.1f);
    }

    callback(pong.time);
    }
    }[/code2]

    Just start the coroutine and pass the parameters (Region, and the method to call after ping is done).

    Example:


    [code2=csharp]private void Start()
    {
    StartCoroutine(PingPhoton.PingRegion(PingPhoton.Region.EU, WhenPingIsDone));
    }

    private void WhenPingIsDone(int ping)
    {
    Debug.Log(ping);
    }[/code2]
  • We do about the same but use an average of several pings.

    Not sure why the result should be so different. As said: We cache the result, so it's not always re-pinged. Maybe you got a good ping in one case but later on get different results?