문제

In ToyVpnService they read IP packets and then forward them to a remote VPN server.

  1. Why do they use DatagramChannel? Isn't DatagramChannel used with UDP only?
  2. Why do they forward packages with their IP and TCP headers? There are a lot of examples of writing arbitrary data to sockets (for example, here) without headers.
도움이 되었습니까?

해결책

From what I can tell the ToyVpnService is either an experiment or in a very early stage of development.

  1. Yes, it's only used for UDP. They either don't care about lost packets at this stage or they plan to implement a control mechanism later.

  2. In the messenger example that you provide, the apps exchange strings. They don't need to send any other info because they only want to display them. When you communicate with a VPN you have to send the headers so the VPN can forward any data it receives.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top