[英]Still cannot connect through Internet even after PortMapping UPnP (Mono.Nat) with the Mirror framework
即使在端口映射(使用 Mono.Nat)通过镜像从一个网络通过互联网连接到主机的公共 IP 地址之后,它也不起作用。 项目文件下载
UPnP已启用:
我认为问题不在脚本内部,因为该端口已在路由器设置中打开。 端口映射的脚本:
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);
}
编辑:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.