Search Unity

Problem with multiplayer Port, over internet the port changes!

Discussion in 'Scripting' started by zyndro, Nov 1, 2011.

  1. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    Hello there!

    i'm having an issue with a game in working, i set the port as 25002 and it works ok on my wifi network, however when i try to host a game and connect through internet the port is not 25002, and i get some random port like 41126 or so..

    i think this is related to the NAT port thing, i was using Network.useNat but i think that's obsolete.

    if anyone have any light i really appreciate it!

    Thank you so much!


    Best regards.
    zyndro.
     
  2. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    The server instance incoming port is what you set, the 41126 port is probably the client outgoing port towards the server instance.
    So the client makes the connection from his own ip on port 41126 to the server instance on port 25002.
    The server port is set when you initialize it, the client outgoing port is selected by windows