Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Ping gets bad "ICMP packet response" and returns -

Discussion in 'Multiplayer' started by Ethan, Feb 21, 2009.

  1. Ethan

    Ethan

    Joined:
    Jan 2, 2008
    Posts:
    501
    Hi all,

    i am trying to ping the server as client with this code:

    Code (csharp):
    1. if(Network.isServer)
    2.         {
    3.             ping = 0;
    4.         }
    5.         else
    6.         {      
    7.             if(pingToServer.isDone)
    8.             {
    9.                 ping = pingToServer.time;
    10.                 // on client, connection 0 == server
    11.                 pingToServer = new Ping(Network.connections[0].ipAddress);
    12.                 //Debug.Log(Network.connections[0].ipAddress + "Ping attempt");
    13.             }
    14.         }
    I do this every couple of seconds and once in start().
    But all i get is a ping of "-1" and this message in my
    mac "konsole":

    I checked the ip of "Network.connections[0].ipAddress" (the server) and its right, so is anyone able to figure out whats wrong?

    Thx so far

    Ethan
     
  2. Ethan

    Ethan

    Joined:
    Jan 2, 2008
    Posts:
    501
    Another info:

    it seems to work on LAN but not over the internet.
    Perhaps a problem with the router/NAT ?