Utility funtions for getting hostname and port so we can re-use them for server.