Search Unity

Resolved Can't forward port

Discussion in 'Netcode for GameObjects' started by firstghost, Jan 4, 2023.

  1. firstghost

    firstghost

    Joined:
    May 26, 2022
    Posts:
    2
    I've just set up Unity Networking stuff, and It's not working correctly.
    I'm using Unity Transport
    Connection Data was:
    Adress: 127.0.0.1
    Port: 7777
    Server Listen Adress: blank

    Remote client changed Adress to my external adress... And It was not working. Though it worked fine locally.
    Need to mention, port 7777 is open on my router and I tested it with "Port Forward Network Utilities".
    With google, some answers and some attempts I found the following:

    1. In this setup, "Port Forward Network Utilities" says "port if open" while my game is running. It means that game not uses port at all (In case if it does, "Port Forward Network Utilities" will respond with message that port if being used)
    2. Changing Adrees on host to my external adress results with "Server failed to bind". Though, I found a way to fix it: change Server Listen Adress: 0.0.0.0
    In this case "Port Forward Network Utilities" responds with "port 7777 is locked with some other program" which is correct respond, but remote client still cant't connect.
    3. If the Server Listen Adress is set 0.0.0.0, not matter what "Adress" set on host, remote client can actually connect, but only using some lan emulator (we used RadminVPN).
    Interesting moment is that with Server Listen Adress blank it's now working even with lan emulator

    It looks like, if Server Listen Adress is set 0.0.0.0, game starts using the port, but it not forwards. Firewall on my PC newer asked me, If I wat to trust the programm, but I even comfigured it manually, with no luck.

    What should I change to make it work without lan emulator?
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    Make sure you're forwarding UDP port 7777, and not TCP (which is what most port forwarding tools usually check). The rule in your firewall should also be for the UDP port.

    Also, have you tried simply disabling the firewall? I'm not suggesting that as a long-term solution, but it would rule out any errors in the manual configuration, and would avoid running in pre-established rules that could be overriding the manual one.
     
  3. firstghost

    firstghost

    Joined:
    May 26, 2022
    Posts:
    2
    One day that problem fixed itself, and I still don't know why - I haven't done anything more.
    But still, thank you for the answer.
     
  4. bilanuk123

    bilanuk123

    Joined:
    Feb 27, 2023
    Posts:
    2
    In your final working version of project have you set your host adress to external or local? It is just wierd to me that it can run using external adress...
     
  5. bilanuk123

    bilanuk123

    Joined:
    Feb 27, 2023
    Posts:
    2
    I had simmilar issue to yours, except i was using Radmin VPN for creating a network with my friends. Completly disabling Firewall solved it.