Is there a way to get the socket handle of the running VPN tunnel on the iPhone so that I can use it in the C ++ library

In the simpleTunnel application presented by apple, the container application and the packet tunnel provider use IPC for communication.

When you enable the startVPNTunnel () toggle button , the API will be called, and the OS will launch the packet tunnel provider, which, in turn, calls the overridden startTunnelWithOptions () method . Here we begin our connection to the VPN server. startTunnelWithOptions , in turn, calls startTunnel , which calls createTCPConnectionToEndpoint ( connection = provider.createTCPConnectionToEndpoint (endpoint, enableTLS: false, TLSParameters: nil, delegate: zero) )

How do we get the socket descriptor from this connection (so that I can use it in another C ++ library that sends SSL and other user messages)? (connnection is an instance of the NWTCPConnection class , but NWTCPConnection does not seem to contain a socket handle)

+4
source share
2 answers

Not sure I understand you, but if you are looking for a socket file descriptor, you cannot get it.

0
source

I have not seen a way to get a socket from it. That's why they reveal a high level API for reading / writing / canceling on NWTCPConnection.

createTCPConnectionToEndpoint . . API ( ).

0

Source: https://habr.com/ru/post/1629248/


All Articles