[英]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.