How do I get the local hostname if unresolvable through DNS in Java?

后端 未结 8 2448
清酒与你
清酒与你 2021-02-19 04:38

This sounds like something that should have been asked before, and it has sort of, but I\'m looking to get the local hostname and IP addresses of a machine even when it is not r

8条回答
  •  攒了一身酷
    2021-02-19 05:11

    If you are getting 127.0.0.1 as the IP address then you may need to locate your Operating System specific hosts file and add a mapping to your hostname in it.

提交回复
热议问题