0

I have seen in many apps that when VPN is connected you can get inside the app and if you are not connected you can't get in. How can I do this with Java programming?

  • I'm not sure what exactly are you asking. Is the app connecting to some service that work available only through VPN connection? If so then there is nothing to be done in the app itself, it's just about properly setting up server without public access. – Mirek Pluta Nov 16 '21 at 17:00

1 Answers1

0

Write your program like it would access any other local network resource. Once the user connects to the VPN, the network resource will become available and is handled further down the stack. No need to account for a VPN programmatically in your application.

JonR85
  • 700
  • 4
  • 12
  • Can you please show me an Example? Because I'm new in Java. – Masud Reza Nov 18 '21 at 10:06
  • Your question is not just about Java, but also networking. Lets say the device your application is installed on, is called the 'host'. The host's operating system is what handles the 'Protocol stack'. Once the host is connected to a VPN (virtual private network), the resources on the VPN become available to the host. When your application requests a network resource. The request travels down the application layers through the protocol stack. Because the OS is what handles the protocol stack, your application doesn't have to do anything different.in the way of making a normal network request. – JonR85 Nov 18 '21 at 15:20