Reputation: 51
Even after PortMapping (using Mono.Nat) connecting with the host's public IP address via Mirror from one Network to other networks through the internet doesn't work. Project File Download
UPnP is enabled:
I don't think the problem is inside the script because the port is already opened in the router settings. The script for PortMapping:
private void DeviceFound(object sender, DeviceEventArgs args)
{
Debug.Log("1");
INatDevice device = args.Device;
Debug.Log("2");
Mapping map = new Mapping(Protocol.Tcp, 7777, 7777);
Mapping map2 = new Mapping(Protocol.Udp, 7777, 7777);
Debug.Log("3");
device.CreatePortMap(map);
device.CreatePortMap(map2);
Debug.Log("4");
int test = device.GetAllMappings().Length;
Debug.Log(test);
foreach (Mapping portMap in device.GetAllMappings())
{
Debug.Log("5");
Debug.Log(portMap.ToString());
}
}
private void DeviceLost(object sender, DeviceEventArgs args)
{
INatDevice device = args.Device;
Mapping map = new Mapping(Protocol.Tcp, 7777, 7777);
Mapping map2 = new Mapping(Protocol.Udp, 7777, 7777);
device.DeletePortMap(map);
device.DeletePortMap(map2);
}
Edit:
Upvotes: 0
Views: 661
Reputation: 51
Both UPnP is enabled on both routers, what was missing was the Firewall settings.I had to disable Both of the firewalls on the router settings to connect via the internet using the host's public IP address. ps. massive thanks to @nIcEcOw.
Upvotes: 1