How can I get the unix hostid into Java through some sort of call?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If it has been set by a previous call to
sethostid(long int id)it will reside in theHOSTIDFILE, typically/etc/hostid.If it is not there, you fetch the machine’s hostname. You pull out the address for the hostname, and if that’s IPv4, it is the IPv4 address formatted from dotted decimal to binary with the top 16 bits and the lower 16 bits swapped.