Jump to content

  • Log In with Google      Sign In   
  • Create Account


Local NAT vs Internet NAT


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 dpadam450   Members   -  Reputation: 861

Like
0Likes
Like

Posted 07 July 2012 - 04:55 PM

Still having issues with Android and it is the last thing I have to do before selling my game.

My diagram is such as the matchmaking server and my phone are on the same router. I'm trying to play someone behind another router.

[phone]-[router]-----[router]-[server][phone]

I assume that because of the server and my phone being on the same end, that connecting to the server, the routing/translation is different. Here is what I mean:

I know for a fact that both phones/routers can holepunch.
For each new port I can predict the next port to open.
I test this by opening ports in sequence and pinging the server. Each new port is the old one plus 256 for both routers.

So now I am at the point that I know both peoples next ports to open up. I don't do anything with those ports except try to connect to each other. They never send to anyone else but each other, and yet I can never have them talk to each other.

The only thing I can think of is that my phone is on the same LAN as the server and therefore those ports that the servers sees are some kind of internal ports, and that when I actually go outside the network, those ports would be completely different. That's the only thing I can think of. And when I send to the server I use the routers internet IP and not 192.168.0.x.

Anyone? I'm getting desperate.

Another small diagram:
Internal phone ports vs What the server sees. Guess next port and send each player what those ports should be.
[phone1]
port: 35000 -> 48270 || 35001 -> 48526 || 35002 -> 48782 || next port I save is 49038

[phone1]
port: 35000 -> 48370 || 35001 -> 48626 || 35002 -> 48882 || next port I save is 49138


Both phones then send to each IP and port that should be the next opened and nothing ever happens. They send and receive on those ports over and over ever 2 seconds.

Edited by dpadam450, 07 July 2012 - 05:01 PM.


Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5098

Like
0Likes
Like

Posted 08 July 2012 - 11:10 PM

It's possible your router doesn't do "hairpin NAT." Check the FAQ, or google for that term.
enum Bool { True, False, FileNotFound };

#3 dpadam450   Members   -  Reputation: 861

Like
0Likes
Like

Posted 08 July 2012 - 11:30 PM

Well that didn't help. But I sat on this issue ALLLLLL day hoping someone would help. And yet it did. Remember those good functions htons and ntohs for winsock? Yea so I just started up the client/server, and checked where the reply to client was actually coming from and it was not the servers dedicated/port forwarded port (8004) but instead (17439). So I was like damn it must be that conversion. Pop ntohs(17439) and what do you get? 8004!!! woooooo. Now lets hope this works tomorrow when I test.

And hairpin was not the the issue although it is hairpining. Damn issue was I never sent the right ports!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS