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

waldo kitty wkitty42 at windstream.net
Tue Apr 9 20:00:57 CEST 2013


On 4/9/2013 05:09, Mark Morgan Lloyd wrote:
> 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.

the first DNS server is the one used... if it doesn't respond in X amount of 
time, then it may be retried Y times before the next DNS server listed in resolv 
is tried... then you loop through the time period and retries again for each 
until you get NXDOMAIN or a positive result or have exhausted the list of DNS 
servers in resolv... at that point, the app may return an error code about not 
being able to reach a DNS server...

in some cases, the non-responding DNS server(s) may be blocked out from further 
usage... this may be for some time period or it may require a restart of the 
local DNS server app (DNS Proxy on some systems) or reboot of the system... i 
have at least one system that acts this way (locking out unresponsive DNS server 
entries and requiring a restart of the DNS proxy app)...

my understanding is that this is pretty much all handled by the OS' library code 
for performing the lookups...




More information about the fpc-pascal mailing list