Post

Replies

Boosts

Views

Activity

Reply to iOS Socket cannot connect ipv6 address when use PacketTunnelProvider
Thank you for your reply Yes, IPV4 works fine. To monitor traffic, I simply print out the source ip and dest ip contained in packets. However, my case is for IPV6, and I have done a lot of preparation for it. I need to re-state my problem so that you can understand it better. The xcode project contains 2 targets. One iOS App target contains some user interfaces, and starts VPN. The server and client are created in the App target. The other is the NetworkExtension plug-in, which contains the IPV6 address to be monitored by PacketTunnelProvider. The process running steps are: Configure an IPV6 address in PacketTunnelProvider. In the iOS App target, after starting VPN, start the server side of the socket in viewDidAppear of viewcontroller and bind this IPV6 address. This is the correct work. The thread sleeps for 3 seconds to ensure that the server side is started, and then starts the client to connect to the IPV6 address bound to the server. At this time, the request timeout and return -1. My question is why it cannot be executed when using IPV6. How do I modify my code to allow clinet to connect to the server? Or can you give me some professional suggestions?
2w
Reply to iOS Socket cannot connect ipv6 address when use PacketTunnelProvider
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.
2w