安卓 VPN 连接

发布于 2024-12-10 19:55:56 字数 1595 浏览 0 评论 0原文

我正在尝试以编程方式启动 VPN 连接。我收到这个错误。我使用的是Android 2.1,我的测试手机内核版本是2.6.32.9。 当我手动连接时,我能够连接到 VPN。但以编程方式,我收到此错误。

java.io.IOException: cannot start service: mtpd
E/VpnService(11817):    at com.android.vpn.DaemonProxy.start(DaemonProxy.java:75)
E/VpnService(11817):    at com.android.vpn.VpnDaemons.startDaemon(VpnDaemons.java:106)
E/VpnService(11817):    at com.android.vpn.VpnDaemons.startMtpd(VpnDaemons.java:127)
E/VpnService(11817):    at com.android.vpn.VpnDaemons.startL2tp(VpnDaemons.java:50)
E/VpnService(11817):    at com.android.vpn.L2tpService.connect(L2tpService.java:31)
E/VpnService(11817):    at com.android.vpn.VpnService.onConnect(VpnService.java:135)
E/VpnService(11817):    at com.android.vpn.VpnServiceBinder$2.run(VpnServiceBinder.java:130)
E/VpnService(11817):    at java.lang.Thread.run(Thread.java:1096)

DeamonProxy: 75 指向以下方法。

private boolean blockUntil(String expectedState, int waitTime) {
        String cmd = SVC_STATE_CMD_PREFIX + mName;
        int sleepTime = 200; // ms
        int n = waitTime * 1000 / sleepTime;
        for (int i = 0; i < n; i++) {
            if (expectedState.equals(SystemProperties.get(cmd))) {
                if (DBG) {
                    Log.d(mTag, mName + " is " + expectedState + " after "
                            + (i * sleepTime) + " msec");
                }
                break;
            }
            sleep(sleepTime);
        }
        return expectedState.equals(SystemProperties.get(cmd));
    }

该方法超时并返回上述错误。

对此的任何帮助/建议都非常感谢。

提前致谢。

I am trying to launch a vpn connection programmatically. I am getting this error. I am using Android 2.1 and my test phone kernel version is 2.6.32.9.
I am able to connect to vpn when i do it manually. But programmatically, I am getting this error.

java.io.IOException: cannot start service: mtpd
E/VpnService(11817):    at com.android.vpn.DaemonProxy.start(DaemonProxy.java:75)
E/VpnService(11817):    at com.android.vpn.VpnDaemons.startDaemon(VpnDaemons.java:106)
E/VpnService(11817):    at com.android.vpn.VpnDaemons.startMtpd(VpnDaemons.java:127)
E/VpnService(11817):    at com.android.vpn.VpnDaemons.startL2tp(VpnDaemons.java:50)
E/VpnService(11817):    at com.android.vpn.L2tpService.connect(L2tpService.java:31)
E/VpnService(11817):    at com.android.vpn.VpnService.onConnect(VpnService.java:135)
E/VpnService(11817):    at com.android.vpn.VpnServiceBinder$2.run(VpnServiceBinder.java:130)
E/VpnService(11817):    at java.lang.Thread.run(Thread.java:1096)

DeamonProxy: 75 points to the following method.

private boolean blockUntil(String expectedState, int waitTime) {
        String cmd = SVC_STATE_CMD_PREFIX + mName;
        int sleepTime = 200; // ms
        int n = waitTime * 1000 / sleepTime;
        for (int i = 0; i < n; i++) {
            if (expectedState.equals(SystemProperties.get(cmd))) {
                if (DBG) {
                    Log.d(mTag, mName + " is " + expectedState + " after "
                            + (i * sleepTime) + " msec");
                }
                break;
            }
            sleep(sleepTime);
        }
        return expectedState.equals(SystemProperties.get(cmd));
    }

This method times out and return the above error.

Any help/suggestion on this is greatly appreciated.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文