- Home /
Host and connect online by external IP
function OnGUI()
{
if(Network.peerType == NetworkPeerType.Disconnected)
{
if(GUILayout.Button("Host"))
Network.InitializeServer(32,25000,false); // This port is opened
if(GUILayout.Button("Connect"))
Network.Connect("xxx.xx.x.xx", 25000); // External IP from ex. http://www.whatsmyip.org/
}
}
(everything I've tried works perfectly on a local network, and by using ex. Hamachi, but not online by itself)
The code above is an example of what I want to do.
The external IP is the same for every computer connected to the same router, and I'm thinking that I'd need to specify my computers Local IP: 192.168.1.37 so that a client can connect client => router => my computer.
I've opened the ports and tried using the Master Server that Unity is hosting at 67.225.180.24:23466 but it fails to connect (possibly because it's down), I also tried hosting my own master server, but I only end up getting "Failed to connect to master server at ..."
I think I read somewhere that the host of a master server has to be connected directly to the internet, is this true?
1# Is my master server not working because I'm connected through a router?
2# Should I try to connect straight to the internet without a router?
3# Is there is a way to connect to a Unity server over the internet without using a master server/facilitator?
4# Is there a way to route a client to a specific computer that is connected through a router?
I plugged my computer to the internet without a router, works perfectly (except for the fact that nobody else in the house gets to connect while I do that)
Is there any way I can connect while still having the router between me and the internet?
Your answer
![](https://koobas.hobune.stream/wayback/20220613114554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
connect with Server(Host) 0 Answers
Network Client Connecting with different Maps 3 Answers
How can i get real "extern" IP address ? 2 Answers
Network.Connect() won't connect? 0 Answers