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

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Apr 13 10:54:34 CEST 2012

I need to resolve a hostname to an IP address, to pass to a minimal 
telnet implementation that expects that as its parameter. The reason 
that I'm not using something "industrial grade" like Synapse is that I'm 
trying to restrict myself to standard libraries so that I can ship 
sources to people who have no FPC experience, making the program both 
useful and a good demonstration of the development tools.

If I use THostResolver.NameLookup I find that it can convert a 
fully-qualified name but not one where the domain is omitted, I notice 
that the README specifically says that resolv.conf isn't fully parsed. 
Unfortunately I find (2.6 on Debian "Squeeze") that GetDomainName 
returns nothing useful- I've not yet investigated whether that's down to 
a particular development system but if it happens to me it might happen 
to others.

In short, how best should I work around this?

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