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

waldo kitty wkitty42 at windstream.net
Mon Apr 8 21:34:14 CEST 2013


On 4/8/2013 14:54, Mark Morgan Lloyd wrote:
> waldo kitty wrote:
>> On 4/8/2013 11:03, Mark Morgan Lloyd wrote:
>>> How best to get the (internet-style) domain name of a system? GetDomainName()
>>> appears to be returning "(none)" here on x86 Linux.
>>
>> do you mean the FQDN (Fully Qualified Domain Name)??
>
> I mean that on the machine I'm working on the hostname is pye-dev-01 and the
> domain name is telemetry.co.uk. I was under the impression that GetDomainName()
> should return the latter, but apart from anything else it's unix-only and whilst
> Windows is not somewhere I want to go today I'd like a portable solution if
> possible.

ok... you are looking for the FQDN, then... the question is how is this machine 
referenced and its FQDN created and maintained... it would seem that you would 
have a DNS server that would return this information... it sounds like your 
machine only has its host name defined and there is nothing else DNS-wise that 
returns the rest of the domain name...

from the machine you are trying to perform this look up from, what do you get if 
you do the following?


nslookup pye-dev-01

nslookup pye-dev-01.telemetry.co.uk


using the last one, i get the message that that machine doesn't exist... of 
course, i'm on the outside and access to this machine may not be allowed from 
outside... not even finding its address...

i don't see this as linux or windows centric... what i'm seeing seems to point 
to a DNS configuration situation... you might be able to handle this with a 
local entry in your HOSTS file...

[crystalball] get nslookup working first. your code should work. [/crystalball]




More information about the fpc-pascal mailing list