7

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.

2
  • Hi, just stopping by to ask - Were you able to overcome this problem? I am having the same issue and looking for a solution. Commented May 25, 2012 at 7:28
  • could you post the code plz? I am also trying to do the same thing. Commented Jul 19, 2014 at 16:13

1 Answer 1

1

First suggestion - check permissions in your manifest. At least android.permission.INTERNET should be listed there.

1
  • 1
    this should be a comment
    – Houcine
    Commented Feb 4, 2015 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.