Search Unity

Which IP to ping to get speed of gameserver ?

Discussion in 'Multiplayer' started by EducaSoft, Apr 21, 2008.

  1. EducaSoft


    Sep 9, 2007

    Since I didn't find example about pinging a gameserver, I tried to make my own and it allready works to ping a certain IP address.

    Now I would like to ping the IP addresses of gameservers retrieved by pollhostlist.

    If element is an element of HostData, then I can retrieve element.ip[0]

    This returns in my case the 192.168;1.108 IP address of my machine.

    It does not return the full public IP address of the machine on the internet.

    Now is that because all My PCs are behind the router and have this kind of local IP, so that unity detects this nd makes sure my IP packets don't leave the internal network ?

    Is this the way to go to ping the IP of the gameserver ? By pinging its element.ip[0] ???

    I also tried with element.ip[1] but that returned me an index out of range, so the array seems to contain only 1 element.

    Any help/clarification is highly appreciated.

    Kind regards,

  2. JavaChilly


    Mar 8, 2008
    I'd say you're doing it right. a server inside your local network will be presented to you with the internal IP, servers outside your local network will be presented with their router's IP.

    As far as multiple IPs, it's technically (RakkNet) possible to have a machine (or farm of them) have multiple IPs for a server service. In this case, the master server can return the full set of IPs and you can provide that complete set to Network.Connect and it will connect to the first one that responds via a ping.