小编Bea*_*Lin的帖子

Android:使用 VPNService 进行 VPN 连接

我正在尝试以编程方式建立并连接到我们自己的VPN(不是默认的VPN提供商,即PPTP、L2TP等,它们存在于Android设置->无线和网络中)。

我想知道截至 2017 年这是否已经可能。

有我用的参考

  1. http://www.thegeekstuff.com/2014/06/android-vpn-service/
  2. https://android.googlesource.com/platform/development/+/master/samples/ToyVpn/src/com/example/android/toyvpn

使用数据报通道时,我收到 PortUnreachableException。这就是我的代码的样子:

@Override
public void run() {
    try {
        Log.i(getTag(), "Starting");
        // If anything needs to be obtained using the network, get it now.
        // This greatly reduces the complexity of seamless handover, which
        // tries to recreate the tunnel without shutting down everything.
        // In this demo, all we need to know is the server address.
        final SocketAddress serverAddress = new InetSocketAddress(mServerName, mServerPort);
        // We try to create the tunnel several times. …
Run Code Online (Sandbox Code Playgroud)

android android-vpn-service

5
推荐指数
1
解决办法
7190
查看次数

标签 统计

android ×1

android-vpn-service ×1