tags:

views:

36

answers:

1

H!

I have source in C, which is use the socket(AF_INET, SOCK_STREAM, 0); C method. I use the NDK and make the jni. Everything is fine, but the application don't work correctly; The original C method return 5 in the console. In Android that value is -1.

I try to add the C source file the #include < socket.h>, but this is not the solution. Something to add AndroidManifest.xml or the Android.mk?

Thanks

+1  A: 

I haven't used the NDK so I don't know if this is the same, but for a regular Android project you need to specify the "INTERNET" permission in the manifest, in order to use the sockets.

anothem
The permission is enforced through Linux process capabilities, so it works the same whether you're in native or interpreted code.
fadden
Good to know, thanks!
anothem