Hello,
I have a C++ code containing this:
char* hostname;
...
struct addrinfo hints;
struct addrinfo *addi;
::memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
int status = ::getaddrinfo(hostname, "9999", NULL, &addi);
if (status != 0) {
fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(status));
return 1;
}
If I run it on the emulator I ever get the following message:
"getaddrinfo failed: servname not supported for ai_socktype"
If I run a similar code on Linux it succeeds. I noticed that Dalvik
uses gethostbyname (in
dalvik/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp)
instead of getaddrinfo.
Is getaddrinfo purposefully not working on Android?
Thanks in advance for your help.
--
My preferred quotation of Robert Louis Stevenson is "You cannot
make an omelette without breaking eggs". Not because I like the
omelettes, but because I like the sound of eggs being broken.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"android-framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---