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

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Apr 17 10:36:10 CEST 2012


Ludo Brands wrote:
>> Bear in mind that files of that type are very much optional 
>> on Windows, 
>> a sop to those who demanded them in order to implement things 
>> like innd 
>> so they could claim it was as good as Unix. My experience is that the 
>> nameserver addresses are available from the Windows registry if 
>> configured statically, I suspect- but I've not checked and 
>> aren't going 
>> to- that that sort of thing will be copied into the registry if it 
>> arrives using DHCP.
>>
> 
> The synapse library has in synamisc.pas function GetDNS: string; which
> returns all DNS servers known on the system (windows or unix).  It uses on
> windows the GetNetworkParams api function from IPHlpAPI.lib and, if not
> succesfull, tries the windows registry.

I'd have used Synapse if this were a program of any significance. 
However as it is it's purely a demo, and in case any of the target 
audience tries to recompile it I've specifically avoided anything 
non-standard (I'm using FPC's ltelnet, but since that isn't in the 
search paths by default I've copied it into my own source).

A later version might use something like cmdline in order to support 
coloured text, but I'll probably make that optional so that the base 
configuration will still compile.

-- 
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