Issue with Native Socket Connection (Error 65) over WiFi Aware on iOS

Dear Apple: 1、We want to create a socket application using the C language interface on the WiFi Aware channel, utilizing native socket APIs such as socket, connect, bind, etc., to transmit data through the established WiFi Aware channel. However, we wrote a demo and tested it. On the iOS side, when initiating a socket connect, we received error code 65. We also used the IPv6 protocol. We would like to ask for help: Is it impossible to use native socket APIs for programming on the WiFi Aware channel? 2、If native sockets are not available, which interfaces are recommended for WiFi Aware communication on iOS?

Thanks.

Answered by DTS Engineer in 898179022

I can answer this part immediately:

which interfaces are recommended for Wi-Fi Aware communication on iOS?

Network framework. It has three different interfaces (the C interface, the original Swift interface, and the new Swift interface), all of which should work over Wi-Fi Aware.

This isn’t a hard question because Network framework is our preferred interface for TCP communications in general. BSD Sockets is supported, but it’s mainly there for compatibility. See TN3151 Choosing the right networking API.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I can answer this part immediately:

which interfaces are recommended for Wi-Fi Aware communication on iOS?

Network framework. It has three different interfaces (the C interface, the original Swift interface, and the new Swift interface), all of which should work over Wi-Fi Aware.

This isn’t a hard question because Network framework is our preferred interface for TCP communications in general. BSD Sockets is supported, but it’s mainly there for compatibility. See TN3151 Choosing the right networking API.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Because our existing code is written using Socket, switching to the Network Framework would be quite costly. Could you provide us with a sample code for Wi-Fi Aware using Socket?

Could you provide us with a sample code for Wi-Fi Aware using Socket?

Well, I dodged that question earlier, and for good reason. My understanding is that there’s no good way to combine Wi-Fi Aware and BSD Sockets. However, before I send you off to file an ER for that, I’m gonna double check…

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

My understanding is that there’s no good way to combine Wi-Fi Aware and BSD Sockets.

I’ve confirmed that with the Wi-Fi Aware engineering team.

You should feel free to file an enhancement request for that support but, in the meantime, you’ll have to use Network framework.

If you do file an ER, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Issue with Native Socket Connection (Error 65) over WiFi Aware on iOS
 
 
Q