views:

21

answers:

0

I'm building a C library we have using the Android NDK build chain. Things are working in general, but the following section is causing problems:

#include <netdb.h>
...
    struct addrinfo* addr_result;

    struct addrinfo hints;
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_protocol = IPPROTO_TCP;

    LOGD("host name: %s", name);
    result = getaddrinfo(name, GCSL_NULL, &hints, &addr_result);
    LOGD("result: %d", result);

getaddrinfo is returning an error code of 7, which translates to "EAI_NODATA".

I tried forcing "name" to easy urls like "www.google.com" and "http://www.google.com" but nothing works.

I'm debugging using the emulator, which in general is able to connect to the Internet from other applications.

Thanks,
-Greg