[fpc-pascal] getaddrinfo

MegaBrutal megabrutal at gmail.com
Fri Mar 20 04:14:38 CET 2015

Hi all,

I'm working on an cross-platform application with DNS resolution with
IPv6 support, but I can't really get around how should I handle IP
version independent DNS resolution. After some searching, I see
getaddrinfo might be a convenient solution, since it is implemented on
multiple platforms, as it is POSIX-standard. Windows and Linux both
have it.

Which unit should I link on Windows and Linux to get getaddrinfo? On
Linux, I managed to link it through cnetdb, though probably there is a
better way. On Windows, I tried Windows, WinSock and WinSock2, but
neither has it.

I also need some help with using the function, as it works very
strangely on Linux, as it returns addrinfo structures, but the ai_addr
member is always a null-pointer, which is theoretically impossible by
the manual, in my understanding.

Though if you have a better idea for cross-platform and IP version
independent network handling with Free Pascal, I'm all ears!


More information about the fpc-pascal mailing list