1

I am finishing up the process of switching from bonjour to avahi in my embedded Linux 3.14. All is working fine,except from the issue of gethostbyname().

Mdns advertised devices are resolved by various avahi utilities (avahi-browse ,resolve,etc.) and by dns_sd callbacks (I have avahi's libdns_sd_compat library installed), except the IP address of mdns advertised device (some_device.local).

For testing gethostbyname() I use the code gethostbyname in C.

Code :

#include <stdio.h>
#include <netdb.h>

int main (int argc, char *argv[])
{
    struct hostent *hstnm;
    if (argc != 2) {
        fprintf(stderr, "usage: %s hostname\n", argv[0]);
        return 1;
    }
    hstnm = gethostbyname (argv[1]);
    if (!hstnm)
        return 1;
    printf ("Name: %s\n", hstnm->h_name);
    return 0;
}

When I switch back to bonjour the function returns a proper structure (from which I can extract the IP address), while in avahi it always returns NULL. I probably miss some kind of entries in configuration files and/or library files. Does someone know what they are ?

Thank You

jww
  • 97,681
  • 90
  • 411
  • 885
glrocks
  • 11
  • 2

0 Answers0