[yocto] Failed Linux network getnameinfo

JH jupiter.hce at gmail.com
Mon Jun 24 01:43:19 PDT 2019


Hi,

I can run following code in Ubuntu to print out the host address, but
I could not get host address (empty) in Yoctor imx6 build. That
function is POSIX compatible, what I could be missing?

struct sockaddr *addr;     /* input */
socklen_t addrlen;         /* input */
char hbuf[NI_MAXHOST];

if (getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), NULL, 0, NI_NAMEREQD))
      printf("could not resolve hostname");
else
      printf("host=%s\n", hbuf);

Thank you.

Kind regards,

- jupiter


More information about the yocto mailing list