简体   繁体   English

如何使用Java从客户端系统检测主服务器IP地址?

[英]how to detect main server ip address from client system using java?

Is it possible to get main server system's(which is connected to LAN) ip address from client system using java? 是否可以使用Java从客户端系统获取主服务器系统的IP地址(连接到LAN)?

If yes, how can i do using code? 如果是,我该如何使用代码?

Generally it is impossible whether using java or any other programming language. 通常,无论使用Java还是任何其他编程语言都是不可能的。 This is the reason that LANs exist. 这就是存在LAN的原因。 The internal IP address is not sent outside the local network and therefore cannot be detected. 内部IP地址未发送到本地网络之外,因此无法检测到。

However if client and server are developed especially to complete this task to can send the IP on application level. 但是,如果专门开发客户端和服务器来完成此任务,则可以在应用程序级别发送IP。 For example to send the IP as a HTTP header if connection is done over HTTP. 例如,如果通过HTTP完成连接,则将IP作为HTTP标头发送。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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