Search Unity

Private IP addresses - USB Broadband Help!

Discussion in 'Multiplayer' started by marraboy, Feb 2, 2009.

  1. marraboy

    marraboy

    Joined:
    Mar 25, 2008
    Posts:
    113
    Hi

    I decided to test my game's multiplayer features using my home broadband and a USB broadband stick.

    I have no issues at all with multiplayer functionality on the home broadband but when I try to create a game or join from the USB broadband stick I get the error 'Unable to connect to IP Address'.

    I know that the USB stick is assigned a private address (10.X.X.X) and this seems to be similar in the way Modem IP addresses are assigned.

    Has anybody else experienced this and is there a way around it. It just seems very odd that a USB stick with a private IP address is unable to route.

    To recap:

    When I use the home broadband and the USB broadband on different PCs I am unable to connect to the game (as if facilitation is not taking place).

    When I use the home broadband on two PCs (essentially on the same private IP subnet) all is fine - this worries me a little as I haven't tested any other PC over the internet.

    Any help/ideas would be appreciated.

    Regards

    John T
     
  2. marraboy

    marraboy

    Joined:
    Mar 25, 2008
    Posts:
    113
    Duplicate removed!
     
  3. marraboy

    marraboy

    Joined:
    Mar 25, 2008
    Posts:
    113
    Update: It seems that the game is registering private IP addresses with the Master server.

    I asked a friend to try and connect and they get the same error: Unable to connect to IP address. So it isn't USB broadband it's actually none of my games that are working! :p

    I used the code to register a game:

    Code (csharp):
    1.  
    2.    private void RegisterGame(string name, string comments, string password)
    3.     {
    4.         Network.useNat = !Network.HavePublicAddress();
    5.         Network.incomingPassword = password;
    6.         Network.InitializeServer(2, 5050);
    7.         MasterServer.RegisterHost(SettingsManager.Instance.MasterServerGameID, name, comments);
    8.        
    9.         ChangeGameState(new WaitForOpponentGameState());
    10.     }
    11.  
    And this to connect to a game:

    Code (csharp):
    1.  
    2.  
    3.    // _ip, _port, _useNat is all determined by a HostData object
    4.    private void ConnectToHost()
    5.     {
    6.         Network.useNat = _useNat;
    7.         Network.Connect(_ip, _port, _password);
    8.     }
    9.  
    I done some debugging and it is registering private IP addresses. Is this normal? Seems odd.



    Ta

    John T
     
  4. marraboy

    marraboy

    Joined:
    Mar 25, 2008
    Posts:
    113
    OK, this is driving me nuts!

    I do a Network.TestConnection() on two clients not on the same IP subnet. I get PrivateIPHasNATPunchThrough result back from both of them. When I try to use NAT assistance I get the error:

    Unable to Connect to IP address.

    No firewalls running on the PCs.

    If I stick port forwarding in on the router it works fine. If I have to do port forwarding then that is fine but why d I get a positive TestConnection result?

    Ta

    JT
     
  5. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    In my experience Network.TestConnection does absolutely nothing useful.

    Larus asked me to file a bug report, but I haven't had the time to investigate it further.

    I actually always set Network.useNat=true for the server, then let the client use whatever is in the hostdata (incase they are on the same private IP subnet).

    I am not exactly sure what a USB broadband stick is though. Does that get internet from celltowers or something? Or is it still getting the internet from your wireless router? Or does it connect to your cable/phone then to computer?
     
  6. marraboy

    marraboy

    Joined:
    Mar 25, 2008
    Posts:
    113
    I am also finding Network.TestBlah() a bit useless but I soldier on! It returns Error sometimes and then a different result the next time it is run. Networks are a pain in the... you get my drift.

    A USB broadband stick is basically a USB stick that connects to the internet via a 'Mobile phone' provider using GPRS/3G/HSPA, see http://en.wikipedia.org/wiki/3G if you are interested.

    I'm having some issues with NAT Punch-through with some users, but it seems that most users in the USA are fine it's the UK I have problems with.
     
  7. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    NAT punchthrough is the biggest problem I have.

    Have you seen this thread I made:
    NATTargetNotConnected Interesting Finding?
    http://forum.unity3d.com/viewtopic.php?t=15243

    It basically does not work with some Routers. I have been getting my players with this problem to try out this link:
    http://helpmewithmygameproblems.com/wiki/XBOX_Live/Nat_Configuration

    Or get them to setup port forwarding. But this really isn't what people want to be doing for a casual game. And many of them are not allowed to change router settings.
     
  8. marraboy

    marraboy

    Joined:
    Mar 25, 2008
    Posts:
    113
    Tell me about it!

    People do not want to do port forwarding! :(

    I am looking at proxy-ing stuff through my own server, but only for basic RPC calls.