Unified in-app VPN SDK's for Microsoft Windows Vista+, Android 4.4+ and Mac OS 10.7+. Earlier OS versions can be supported as well by request. Please contact [email protected] to receive your own API key.

Copyright © 2019 VPNWholesaler.com. All rights reserved.

Back

3.7 checkOpenPort OS X Example

CheckOpenPort() function could be written in the following way:

void CheckOpenPort(const char *ip_addr, const char *proto, int port)
{
    json_object *j_obj, *j_data_obj;
    char szCmd[1024];
    j_obj = json_object_new_object();
    json_object_object_add(j_obj, "cmd", json_object_new_int(OVS_CMD_CHECK_PORT));
    j_data_obj = json_object_new_object();
    json_object_object_add(j_data_obj, "ip_addr", json_object_new_string(ip_addr));
    json_object_object_add(j_data_obj, "proto", json_object_new_string(proto));
    json_object_object_add(j_data_obj, "port", json_object_new_int(port));
    json_object_object_add(j_obj, "data", j_data_obj);
    snprintf(szCmd, sizeof(szCmd), "%s", json_object_get_string(j_obj));
    json_object_put(j_obj);
    CmdProc(szCmd);     
}

Result will be returned via callback as a JSON:

code will be OVS_NOTIFY_CHECK_PORT

err will be OVS_ERR_OK when port is open

data will be null