Relative Content

Tag Archive for androidkotlinsocketsdatagramandroid-vpn-service

Android VPNService – DatagramChannel cannot write packets after calling VPNService.establish

I’m working on a pet VPN project for Android. Now I need to develop an application that would send all packets from the device to a remote server and receive a response from it (without authorization and data encryption). The server part is ready and working fine, but there are problems on the client side. After I call VPNService.establish, a ParcelFileDescriptor is returned to me (i.e. a tun is created on the device) and the UDP connection to the server disappears. I can’t send any packets to the server, although before VPNService.establish I can communicate with the server without any problems. Here is my VPNService code: