[fpc-pascal] Portable (or at least working) version of GetDomainName()?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Apr 9 11:09:17 CEST 2013


Ludo Brands wrote:
> On 04/09/2013 10:14 AM, Mark Morgan Lloyd wrote:
> 
>> It might be notable that Debian doesn't volunteer a domain name unless
>> it's able to contact DNS. I'll get onto nslookup, or just use temporary
>> text (it's only salt for a password hash, and is stored).
>>
> 
> One of the problems with uname is that the kernel doesn't have a clue on
> how you are connected to the network. Your computer could have 10
> network names if it had 10 addresses (not even 10 NIC's required).
> 
> Looking up the IP you want the domain name for in a DNS is the only
> reliable way. And it is portable.

Thanks Ludo, I'd got there. I think there's still the possibility of 
ambiguity if there are multiple DNS servers listed in resolv.conf, but I 
agree that it's probably the best way available.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list