Android VpnService protect socket that's stored in native code?

馋奶兔 提交于 2019-12-03 14:51:37

I simply wanted verification that my processes was valid, after completing more testing I've verified that it works.

Example

// Native Code
int socket;

JNIEXPORT jint JNICALL
Java_com_my_package_Class_initializeSocket
(
    JNIEnv *env,
    jobject jobj
) {
    socket = socket(AF_INET, SOCK_DGRAM, 0);

    // . . . Handler other socket preparations 

    return (jint)socket;
}

// Java Code
public native int initializeSocket();

. . . 

int socket = initializeSocket();
this.protect(socket);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!