Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Cant connect to host through public IP.

Discussion in 'Multiplayer' started by Epic-Username, Oct 18, 2016.

  1. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    When i try to connect to the host with my public IP it doesn't connect, It doesn't return any error messages or warnings, I have port-forwarded and tried disabling all firewalls but it still wouldn't connect, so what is likely to be the issue here?. here is part my script for the connections:

    Code (CSharp):
    1. void CreateServer(){
    2.         manager.networkPort = 7777;
    3.         manager.StartHost();
    4.     }
    5.  
    6.     void JoinServer(){
    7.         manager.networkAddress = serverIP.text;
    8.         manager.networkPort = 7777;
    9.         manager.StartClient();
    10.         Debug.Log (manager.networkAddress + ":" + manager.networkPort);
    11.     }
     
  2. tungchengvn

    tungchengvn

    Joined:
    Sep 30, 2014
    Posts:
    13
    Did you setup network firewall for your port?

     
  3. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    Yeah, i tried this but it still doesn't work though.
     
    wlwl2 likes this.
  4. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    Have you run the server and client on the same machine and tried the loopback/local IP address, just to be sure you can connect at all? ie. 127.0.0.1
     
  5. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    Yes i can connect through my local IP, but not though my public IP which tells me that its working but i just cant connect through the internet.
     
  6. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    Update: just in case i wasn't clear on what i want to do, I want to create a master server on a machine at home (until i can afford to rent a server) which other clients can connect to because i don't want to use unity matchmaking for these reasons:
    1. It requires a client to run a host so when they quit the game shuts down,
    2. I want to support up to 200 players in each game and unity free matchmaking only supports 20.
    3. The type of game i want to create is a small MMO game and i don't think using matchmaking is the best option for that.
    4. I want to keep it open 24/7 even when no-one is in the server.
     
  7. Jos-Yule

    Jos-Yule

    Joined:
    Sep 17, 2012
    Posts:
    292
    Another possibility is your ISP may block the ports you are trying to connect too? Are you _sure_ you have the right public IP address? Are you _sure_ you have your NAT tables setup correctly? Can you connect, on your LAN, from one client machine to the server machine, using LAN IPs? Those are things I would check, double check, etc.

    Good luck!!
     
  8. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    I'm sure my networking is working properly because i have started ports for other games like Minecraft for example where i successfully connected through my public IP.
     
    Last edited: Mar 8, 2017
  9. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    ... Still having the issue.
     
  10. soul667

    soul667

    Joined:
    Feb 16, 2017
    Posts:
    5
  11. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
  12. soul667

    soul667

    Joined:
    Feb 16, 2017
    Posts:
    5
    Then you should check your modem/router/firewall settings. Do you use port 7777?
    What rules do you have defined on your router? In the video the from tungchengvn around 6:40 is what you have to check on your router. Maybe you can post some of your settings here.
    I don't know how Minecraft handles networking. Maybe it opens the port on the router with UPNP.
     
  13. Epic-Username

    Epic-Username

    Joined:
    May 24, 2015
    Posts:
    339
    - I Disabled my firewalls when i was testing the connection.
    - I used port 7777 but i also tried other ports.
    - Rules for router?.