public static void init(String resource) throws FileNotFoundException, IOException, MyException {
        ClientGlobal.config = new Config(resource);

        String[] szTrackerServers;
        String[] parts;

        g_connect_timeout = config.getIntValue("connect_timeout", DEFAULT_CONNECT_TIMEOUT);
        if (g_connect_timeout < 0) {
            g_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
        }
        g_connect_timeout *= 1000; // millisecond

        g_network_timeout = config.getIntValue("network_timeout", DEFAULT_NETWORK_TIMEOUT);
        if (g_network_timeout < 0) {
            g_network_timeout = DEFAULT_NETWORK_TIMEOUT;
        }
        g_network_timeout *= 1000; // millisecond

        g_charset = config.getStringValue("charset");
        if (g_charset == null || g_charset.length() == 0) {
            g_charset = "ISO8859-1";
        }

        szTrackerServers = config.getStringValue("tracker_server").split(";");
        if (szTrackerServers == null) {
            throw new MyException("item \"tracker_server\" in " + resource + " not found");
        }

        InetSocketAddress[] tracker_servers = new InetSocketAddress[szTrackerServers.length];
        for (int i = 0; i < szTrackerServers.length; i++) {
            parts = szTrackerServers[i].split("\\:", 2);
            if (parts.length != 2) {
                throw new MyException(
                        "the value of item \"tracker_server\" is invalid, the correct format is host:port");
            }

            tracker_servers[i] = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim()));
        }
        g_tracker_group = new TrackerGroup(tracker_servers);

        g_tracker_http_port = config.getIntValue("http.tracker_http_port", 80);
        g_anti_steal_token = config.getBooleanValue("http.anti_steal_token", false);
        if (g_anti_steal_token) {
            g_secret_key = config.getStringValue("http.secret_key");
        }
    }