Skip to content

Instantly share code, notes, and snippets.

@robUx4
Created July 8, 2014 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robUx4/4a8a6f15c4e7d96021e3 to your computer and use it in GitHub Desktop.
Save robUx4/4a8a6f15c4e7d96021e3 to your computer and use it in GitHub Desktop.
Android InetSocketAddress source
/**
* Returns the hostname if known, or the result of {@code InetAddress.getHostAddress}.
* Unlike {@link #getHostName}, this method will never cause a DNS lookup.
* @since 1.7
* @hide 1.7 - remember to add a link in the getHostName documentation!
*/
public final String getHostString() {
return (hostname != null) ? hostname : addr.getHostAddress();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment