Sign in to follow this  
dpadam450

Local NAT vs Internet NAT

Recommended Posts

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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this