[fpc-pascal] Resolving a local hostnames to an IP address

waldo kitty wkitty42 at windstream.net
Sat Apr 14 04:15:26 CEST 2012


On 4/13/2012 04:54, Mark Morgan Lloyd wrote:
> If I use THostResolver.NameLookup I find that it can convert a fully-qualified
> name but not one where the domain is omitted,

can you explain this a bit more, please? the reason i ask is because some code 
wants at least one dot separator...

example:
foo.bar  -- .bar is the TLD and foo is the hostname
foo.bar. -- the last dot says this is the end, do not look to other domains

so...

foo      -- may result in other domains being automatically looked up by
             stuffing known TLDs after it ie: foo.com, foo.net, foo.org...

*BUT*

foo.     -- says there is no more domains to look at... so effectively one
             is looking for only the LAN name which should be easily served
             up by the LAN DNS server or the HOSTS file...

some systems need the trailing dot and others do not... i've seen this problem 
for years and it seems to be limited to some OS' to a certain extent...

> I notice that the README specifically says that resolv.conf isn't
> fully parsed.

in the above, i'm speaking purely from a network admin/tech/specialist POV... i 
work with a FOS firewall product and this is quite a common problem IF what i'm 
thinking it is is correct...

sadly i've not (yet!) the coding knowledge in this area to be able to be more 
specific or of more help :?

the main point is that many do not know about the use of the trailing dot to 
denote that there are no other domains to append in an attempt to locate the 
given hostname...

clarification:
foo.bar     -- foo is the hostname, bar is the TLD...
foo.bar.com -- foo is the hostname, bar is a SLD, and com is a TLD...
foo.        -- says look up "foo" only...
foo.bar     -- says look up "foo.bar" first and maybe other TLDs behind...
foo.bar.    -- says look up "foo.bar" and don't look up more than that...

i hope this makes sense and is of some assistance...



More information about the fpc-pascal mailing list