Improved hostname() function.

This is a pull request that should close #43.  This new implementation better respects the DNS provided name by using the addresses on the system to resolve the hostname from DNS if possible before calling back on the system's setup.