Search Unity

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

Network.TestConnection how to?

Discussion in 'Multiplayer' started by nafonso, Jul 27, 2008.

  1. nafonso

    nafonso

    Joined:
    Aug 10, 2006
    Posts:
    377
    Hi,

    I'm currently trying to figure out just how Network.TestConnection works. The thing that confuses me the most, is that we are able to set Network.connectionTesterIP and Network.connectionTesterPort.

    So I though, if I want to test my Network capabilities, I just set connectionTesterIP as 127.0.0.1 and the port to the one I want to open up if I create a server. However, when I do this, I always get Undetermined in Network.TestConnection. And what confuses me more (maybe it is a bug?), if I try again to determine the network capabilities without setting the IP and Port (like it is on the example in Network.TestConnection documentation) I always get Error. In order to make it work again, I have to close unity and relaunch it.

    So, basically, when should I use connectionTesterIP and Port? When I want to get info about a server that is not registered with MasterServer (i.e. direct ip connection)?

    Regards,
    Afonso
     
  2. Der Dude

    Der Dude

    Joined:
    Aug 7, 2006
    Posts:
    213
    When Unity tests the connection to a specific server, the server must already be running (if I remember correctly).
    So before starting the test, start the server.
     
  3. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    You can run the connection test any time, no need to start a server.
    The connection tester runs on the same IP as the master server and just helps to establish, from outside, whether you are on a public/private IP and if you are NAT punchable.