Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can I find the full hostname (FQDN) of the system I am running on?

Answer Posted / chaitanya

Some systems set the hostname to the FQDN and others set it to just the unqualified host name. I know the current BIND FAQ recommends the FQDN, but most Solaris systems, for example, tend to use only the unqualified host name.

Regardless, the way around this is to first get the host's name (perhaps an FQDN, perhaps unaualified). Most systems support the Posix way to do this using uname(), but older BSD systems only provide gethostname(). Call gethostbyname() to find your IP address. Then take the IP address and call gethostbyaddr(). The h_name member of the hostent{} should then be your FQDN.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a socket connection?

1002


What is the difference between a socket and a port?

928


Why does the sockets buffer fill up sooner than expected?

1387


How many sockets can a cpu have?

887


Can a socket have multiple ports?

913


What's the difference between a socket and a port?

898


How can I write a multi-homed server?

1689


How are unix domain sockets implemented?

911


What's the difference between impact sockets and regular sockets?

903


Can multiple clients connect to same socket?

950


What is socket address?

1082


system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?

1666


What are the types of sockets?

969


How is a socket created?

968


What's better 6pt or 12pt sockets?

864