onsdag den 18 augusti 2010 klockan 11:18 skrev Tanguy Ortolo detta: > Le mercredi 18 août 2010, Sergey Poznyakoff a écrit???: > > > It is currently quite rough: no localization, no options, and so on. But > > > I think it just works. Do you think such a tool would be worth being > > > integrated to some software suite, such as inetutils? > > > > Such a tool would certainly be useful. However, I have serveral > > questions regarding the implementation: > > > > 1. You use gethostbyname2, which is a glibc extension and is not > > available on other systems. I'd suggest to use getaddrinfo instead. > > At first time, I tried using gethostbyname, but it seems to support only > AF_INET, and returns NULL when asked for a hostname that only resolves > to an IPv6 address. Then I looked to getaddrinfo, but it seems to > require a service name, that is inappropriate for simple name > resolution??? >
A service given as a numerical string is also accepted by getaddrinfo(3). If the service is a priori known to represent a numerical value, any look up is avoided by use of the flag NI_NUMERICSERV. Regards, Mats E A