[英]Still cannot connect through Internet even after PortMapping UPnP (Mono.Nat) with the Mirror framework
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.即使在端口映射(使用 Mono.Nat)通过镜像从一个网络通过互联网连接到主机的公共 IP 地址之后,它也不起作用。 Project File Download
项目文件下载
UPnP is enabled: UPnP已启用:
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:编辑:
Both UPnP is enabled on both routers, what was missing was the Firewall settings.两个路由器都启用了 UPnP,缺少的是防火墙设置。
I had to disable Both of the firewalls on the router settings to connect via the internet using the host's public IP address.
我必须禁用路由器设置上的两个防火墙才能使用主机的公共 IP 地址通过互联网连接。 ps.
附言。 massive thanks to @nIcEcOw.
非常感谢@nIcEcOw。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.