簡體   English   中英

使用 Mirror 框架 PortMapping UPnP (Mono.Nat) 后仍然無法通過 Internet 連接

[英]Still cannot connect through Internet even after PortMapping UPnP (Mono.Nat) with the Mirror framework

即使在端口映射(使用 Mono.Nat)通過鏡像從一個網絡通過互聯網連接到主機的公共 IP 地址之后,它也不起作用。 項目文件下載

UPnP已啟用:

路由器的 UPnP 設置,游戲在此處列出了 TCP 和 UDP

我認為問題不在腳本內部,因為該端口已在路由器設置中打開。 端口映射的腳本:

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);

}

編輯:

  • 在第一段中添加了鏡像文檔。 您可以在“傳輸”中找到有關 Tcp/Udp 的信息。
  • 添加項目文件下載

兩個路由器都啟用了 UPnP,缺少的是防火牆設置。 防火牆 我必須禁用路由器設置上的兩個防火牆才能使用主機的公共 IP 地址通過互聯網連接。 附言。 非常感謝@nIcEcOw。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM