Skip to content

About

Prints the local hostname as Java would resolve it on Linux.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javahostname

Prints the local hostname as Java would resolve it on Linux.

This program simulates how the local hostname is resolved in the OpenJDK Java 8 runtime, as outlined below.

  1. resolve local hostname with gethostname(2)
  2. resolve ip address belonging to the hostname you got in step 1 with getaddrinfo(3)
  3. resolve canonical hostname for the ip address with getnameinfo(3)

Installation

  1. generate build scripts (used autoconf 2.69)
$ autoreconf --install
  1. configure and build
$ ./configure
$ make
  1. run program
$ src/javahostname

Further reading

man 2 gethostname
man 3 getaddrinfo
man 3 getnameinfo

About

Prints the local hostname as Java would resolve it on Linux.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages