Mataharrie
Mataharrie

Reputation: 43

LocalEndPoint in remote format C#

I see that applications in my computer have an IP address of 192.168.1.1. How do I get the localEndPoint in remote format (what the server sees)?

Upvotes: 1

Views: 97

Answers (1)

Anders Abel
Anders Abel

Reputation: 69270

Do you mean that you are on a NATed network and want to see the address that your outbound requests are NATed to?

In that case you can't do it solely at the local PC at all. The whole idea of NAT is that your local PC shouldn't know about it. To get the IP exposed to the internet you need to ask someone on the Internet what your connection appears to be coming from. One such service is www.whatismyip.org.

The reply from that site is simple enough that it should be possible to parse it out using C#. Make a web request to that site and check what it returns.

Upvotes: 2

Related Questions