Search Unity

PublicIPNoServerStarted, Just how do you start the server

Discussion in 'Multiplayer' started by Harry Tuttle, Jun 15, 2009.

  1. Harry Tuttle

    Harry Tuttle

    Joined:
    Jan 3, 2006
    Posts:
    122
    I'm still confused about ConnectionTesterStatus.PublicIPNoServerStarted despite having browsed through the forum and help.

    As I understand it in order to prevent this status from occurring you need to initialize a server. So does this mean you should call Network.InitializeServer(...) before running Network.TestConnection() or does it mean something else.

    If I start a server, wait for OnServerInitialized and then run Network.TestConnection() then the following line:

    Code (csharp):
    1. Debug.Log(Network.isServer + ": " + sTestConnectionStatus);
    always prints:
    Code (csharp):
    1. True: Public IP address but server not initialized, it must be started to check server accessibility
    Have I totally misunderstood this connection status?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    if the machine is meant to be the server then yes you need to initialize it before testing.
     
  3. Harry Tuttle

    Harry Tuttle

    Joined:
    Jan 3, 2006
    Posts:
    122
    hmmm, sounds like bug then, I'll post a bug report.
    (Thanks for the quick post response by the way!)
     
  4. Harry Tuttle

    Harry Tuttle

    Joined:
    Jan 3, 2006
    Posts:
    122
    hmmm, hmmm. I think my problem is partly due to the fact that the Network interface thingamajig doesn't reset itself in the editor when you stop the game.

    I now reload the project when ever I run a test to ensure that any results are consistent.
     
  5. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Hello Harry

    Were you able to avoid the PublicIPNoServerStarted?

    If so, are you initializing the server or not?

    Thanks
     
  6. Harry Tuttle

    Harry Tuttle

    Joined:
    Jan 3, 2006
    Posts:
    122
    Hi Andres

    Yes, but because of the issues with starting a server, testing the connection and closing it down I gave up.

    Instead if I get a ConnectionTesterStatus.PublicIPNoServerStarted status I just test for NAT punchthrough - e.g. I treat it exactly the same as a PublicIPPortBlocked
    Code (csharp):
    1.  
    2. if( ConnectionTesterStatus.PublicIPPortBlocked || ConnectionTesterStatus.PublicIPNoServerStarted)
    3. {
    4.             testMessage = "Non-connectible public IP address (port " + myServerPort +" blocked), running a server is impossible.";
    5.             Network.useNat = false;
    6.             // If no NAT punchthrough test has been performed on this public IP, force a test
    7.             if (!probingPublicIP)
    8.             {
    9.                 Debug.Log("Testing if firewall can be circumnvented");
    10.                 natCapable = Network.TestConnectionNAT();
    11.                 probingPublicIP = true;
    12.                 timer = Time.time + 10;
    13.             }
    14.             // NAT punchthrough test was performed but we still get blocked
    15.             else if (Time.time > timer)
    16.             {
    17.                 probingPublicIP = false;        // reset
    18.                 Network.useNat = true;
    19.                 donotRunTest = true;
    20.             }
    21. }
    22.  
    [/code]
     
  7. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Thank you Harry

    I gave up also. And unfortunately I am not able to get results from your workaround either.

    Do you start the server in this other case? I mean, before running Network.TestConnectionNAT().

    All my tests end up on the timeout because the Network.TestConnectionNAT() never gets a result. With or without the server initialized.

    :?
     
    Last edited: Mar 21, 2011
  8. Harry Tuttle

    Harry Tuttle

    Joined:
    Jan 3, 2006
    Posts:
    122
    Andres,

    I don't start a server in any situation now to test connectivity.

    I'm a bit surprised that you get a timeout with Network.TestConnectionNAT(), this indicates that something upstream is ignoring your request (or doesn't exist) - maybe you have some sort of proxy/firewall/port forwarding permission issues ?
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    the nat tests require a master server to be present.
    I guess you aren't running one and as you can't rely on UTs beeing present you basically can end in situations where ET phones nowhere.
     
  10. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Harry

    My computer is directly connected to the cable-modem. Comcast is my provider and I don't think they firewall my traffic.

    Additionally, when I make a connection it does work.
     
  11. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    What dreamora says makes sense.

    is there anyway to run a reliable Master Server on my own?
     
  12. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You can download the sources of the 0.x beta from the website and run it on your machine if you want to for example or any other machine available.

    after that, alter the ip for the master server so it connects to yours, not UTs