[erlang-questions] reliably figure out hostname

Tim Watson watson.timothy@REDACTED
Thu Aug 2 17:29:22 CEST 2012


On 2 Aug 2012, at 15:31, Raimo Niskanen wrote:

> On Thu, Aug 02, 2012 at 09:40:03AM +0100, Gustav Simonsson wrote:
>> 
>> {ok, LocalHostName} = inet:gethostname().
>> inet_res:gethostbyname(LocalHostName).
> 
> That forces using the OTP DNS resolver, which may be in conflict
> with the current node configuration. The first approach should be:
> 
>    {ok, LocalHostName} = inet:gethostname().
>    inet:gethostbyname(LocalHostName).
> 

Thanks both of you, I'll look at both these and see what comes up on the machines that are causing issues. My fallback position is to make the test operator provide a settings file with their FQDN when using longnames configurations, which at least minimises the impact, but still it'd be nice to do this without forcing the user to intervene. I will post back to the list if/when I find out the best approach for my own particular use case.

Cheers!
Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120802/74a10318/attachment.bin>


More information about the erlang-questions mailing list