远程格式 C# 中的 LocalEndPoint
我看到我的计算机中的应用程序的 IP 地址为 192.168.1.1。如何获取远程格式的 localEndPoint(服务器看到的内容)?
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是您位于 NAT 网络上并且想要查看您的出站请求经过 NAT 处理的地址吗?
在这种情况下,您根本无法仅在本地 PC 上执行此操作。 NAT 的整体理念是您的本地 PC 不应该知道它。要将 IP 暴露给互联网,您需要询问互联网上的某人您的连接似乎来自何处。 www.whatismyip.org 就是此类服务之一。
该站点的回复非常简单,应该可以使用 C# 对其进行解析。向该站点发出网络请求并检查它返回的内容。
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.