I am trying to create a VPN client on android. I looked at android sample application "ToyVpn", I tried to connect to my PC( Windows 7) from this app but I'm getting port unreachable exception.
E/ToyVpnService(2302): Got java.net.PortUnreachableException:
E/ToyVpnService(2302): Got java.net.SocketException: sendto failed: ECONNREFUSED (Connection refused)
But when I connect to my PC via default vpn client of Android then it connects successfully. And by typing "netstat" in command line I observed that my pc's port 1723 is connected to phone's port 36302. So, offcourse port is reachable.
It is sample application, it should work...But I saw someother links too which mentioned that they are unable to connect to server via this app.
Does this sample work at all? Does this API needs rooted phone?
Except for this I did not find any sample or tutorial to show proper use of "android.net.VpnService".
Can any one please guide me about this..?
ToyVpnService is a sample implementation of a simple custom VPN. It is not standards compliant. If you want a standards compliant VPN you should use the built in one.
If you want to test the sample there is a linux server that understands the ToyVPN protocol that is packaged with ToyVPN example.
https://github.com/android/platform_development/tree/master/samples/ToyVpn
It is called ToyVPN because it is just that.
It only shows how the VpnService API can capture packets from application on the phone destined for the internet and push them down a tunnel. Similarly, how to inject packets into application as though they came from the network.
The rest is upto the developer to implement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With