简体   繁体   中英

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 ;)

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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM