[fpc-pascal] Linux: resolving hostnames in local network

Michael Van Canneyt michael at freepascal.org
Sat Apr 23 11:30:19 CEST 2016



On Sat, 23 Apr 2016, Andreas Klausmann wrote:

> Hi,
> how can I resolve hostnames in a local (private) network under linux?
> Both gethostbyname() and THostResolver work fine for google.com etc, but
> not for local hostnames like testhost.local.
> Testhost is reachable from console by hostname: ping testhost.local ->
> success (resolved in background by avahi)
>
> gethostbyname() works fine under Windows even for LAN resolution
> (resolved in background by Netbios name service).
>
> Currently I'm working on Ubuntu 15.10 on a raspberry, fpc 3.0.

You will need to use the C library routines for this.
The FPC native implementation does not work with avahi or local DNS caches.

Michael.



More information about the fpc-pascal mailing list