Migua
Migua

Reputation: 555

How can I Know router port I'm connected through with java

I need to know the port i'm connected through the router , because I want to send it to an app, where an android can read it , and connect to my local app using the public ip of my router and the port. Can you help me? sorry for my bad english ;)

Upvotes: 0

Views: 424

Answers (1)

Amadan
Amadan

Reputation: 198294

That's not how it works. A router performs NAT, which means it rewrites things in such a way that your application will get the packets intended for it even if the other end sends to your router's public IP, as long as you initiate a connection from inside the router.

If both ends are behind a NAT, you normally need to have a public-facing server which can mediate (description)

Upvotes: 1

Related Questions