Thanks for your reply.
What does your packet tunnel provider do?
I am making a case about how to use NetworkExtension to monitor ipv6 traffic to teach others how to use NetworkExtension to develop their own applications, such as the code listed above.
Why does its container app have a client and a server in it?
Since it is a case, I wrote both the server and the client in the viewcontroller of the main target to facilitate others to run directly on iOS devices without a real remote server.
When your tunnel is up, how are you expecting traffic to flow through the system?
In this case, I have not yet successfully connected from the client to the server, so the sample code is not implemented in the readPackets function
The current problem is that if I change the code provided above to the ipv4 version, it can be executed correctly.
After changing to ipv6, when the client connects to the ipv6 address bound to the server, the program times out and returns -1 when it runs to
connect(client_fd, (struct sockaddr *)&server_addr, sizeof(server_addr))
of dx_connect_to_ipv6_server, which is very confusing.