w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Java comparing if virtual host name and physical host name are same

Assuming that:

  1. the host's network interfaces are configured for all of its IP addresses, and

  2. you are running the "test" code on the host itself,

then you can resolve the hostnames to IP addresses, and compare them against all of the addresses bound to the NetworkInterface objects returned by NetworkInterface.getNetworkInterfaces().

If either of those assumptions is incorrect, then I don't think there is an easy way to do this.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.