Class NetworkUtils


  • public class NetworkUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      NetworkUtils()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getHostAddress()  
      java.lang.String getHostname()
      Makes a best-effort attempt to figure out an externally addressable name for this host, falling back to a local connection only.
      java.net.InetAddress getIp4NonLoopbackAddressOfThisMachine()
      Returns a non-loopback IP4 hostname of the local host.
      java.lang.String getIpOfLoopBackIp4()  
      static java.lang.String getNetWorkDiags()  
      java.lang.String getNonLoopbackAddressOfThisMachine()
      Used by the mobile emulators that refuse to access localhost or 127.0.0.1 The IP4/IP6 requirements of this method are as-of-yet unspecified, but we return the string that is associated with the IP4 interface
      java.lang.String getPrivateLocalAddress()  
      java.lang.String obtainLoopbackIp4Address()
      Returns a single address that is guaranteed to resolve to an ipv4 representation of localhost This may either be a hostname or an ip address, depending if we can guarantee what that the hostname will resolve to ip4.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NetworkUtils

        public NetworkUtils()
    • Method Detail

      • getHostname

        public java.lang.String getHostname()
        Makes a best-effort attempt to figure out an externally addressable name for this host, falling back to a local connection only. This may be a hostname, an IPv4 address, an IPv6 address, or (as a last resort) localhost.
      • getHostAddress

        public java.lang.String getHostAddress()
      • getPrivateLocalAddress

        public java.lang.String getPrivateLocalAddress()
      • getNonLoopbackAddressOfThisMachine

        public java.lang.String getNonLoopbackAddressOfThisMachine()
        Used by the mobile emulators that refuse to access localhost or 127.0.0.1 The IP4/IP6 requirements of this method are as-of-yet unspecified, but we return the string that is associated with the IP4 interface
        Returns:
        A String representing the host name or non-loopback IP4 address of this machine.
      • getIp4NonLoopbackAddressOfThisMachine

        public java.net.InetAddress getIp4NonLoopbackAddressOfThisMachine()
        Returns a non-loopback IP4 hostname of the local host.
        Returns:
        A string hostName
      • obtainLoopbackIp4Address

        public java.lang.String obtainLoopbackIp4Address()
        Returns a single address that is guaranteed to resolve to an ipv4 representation of localhost This may either be a hostname or an ip address, depending if we can guarantee what that the hostname will resolve to ip4.
        Returns:
        The address part og such an address
      • getIpOfLoopBackIp4

        public java.lang.String getIpOfLoopBackIp4()
      • getNetWorkDiags

        public static java.lang.String getNetWorkDiags()