I'm trying to programmatically obtain the IP address of a remote PC on my network from the PC's hostname. The PC is running as an Apache server. It is my understanding that in the DNS query used to obtain the IP address from the hostname, the DNS suffix needs to be appended to the hostname. Can I query the DNS server to get the DNS suffix used for this PC?
Normally, DHCP and your host's DNS resolver will take care of this:
So, if you only use your OS's "official" functions, you do not need to know the full name. If you send out DNS packets manually, you will need to obtain that information from the configuration files (or, in Windows, the registry).
If this is an internal network (e.g., a private network behind a NAT box), the "FQDN" address returned will not be valid outside that network.