Copy some android source code to help you(JNI):
static jobject osNetworkSystem_getHostByNameImpl(JNIEnv* env, jclass clazz,
jstring nameStr, jboolean preferIPv6Addresses) {
}
static void osNetworkSystem_setInetAddressImpl(JNIEnv* env, jobject obj,
jobject sender, jbyteArray address) {
}
static jobject osNetworkSystem_inheritedChannelImpl(JNIEnv* env, jobject obj) {
}
/*
* JNI registration.
*/
static JNINativeMethod gMethods[] = {
/* name, signature, funcPtr */
{ "getHostByNameImpl", "(Ljava/lang/String;Z)Ljava/net/InetAddress;", (void*) osNetworkSystem_getHostByNameImpl },
{ "setInetAddressImpl", "(Ljava/net/InetAddress;[B)V", (void*) osNetworkSystem_setInetAddressImpl },
{ "inheritedChannelImpl", "()Ljava/nio/channels/Channel;", (void*) osNetworkSystem_inheritedChannelImpl },
};
int register_org_apache_harmony_luni_platform_OSNetworkSystem(JNIEnv* env) {
return jniRegisterNativeMethods(env,
"org/apache/harmony/luni/platform/OSNetworkSystem",
gMethods,
NELEM(gMethods));
}