TCP connection in with Wi-Fi aware framework never reaches ".ready" state

While developing our wifi-aware implementation we ran into a specific issue where TCP connections seem to never reach a "ready" state (ready to transfer data). It stays in “”preparing” state trying to connect for forever.

We tried to recreate a new TCP connection every time after the connection stays in "preparing" for longer than 10 seconds. This helps to "recover" eventually, but it only happens after 1.5 - 2 minutes.

Creating a completely new NetworkBrowser and NetworkListener doesn’t speed up this process.

The issue occurs when the browser and listener are setting up the NAN/TCP connection, at that time if the user opens the DevicePairingView it seems that it disrupts or interferes with the connection, entering an invalid state. From what we can see it takes around 2 minutes for it to recover, presumably this is when NAN drops the connection (timeout) and creates a new one.



STEPS TO REPRODUCE Reproduction steps:



  1. Open the app on 2 wifi-aware devices.


  2. Device 1 presses “Pair with device”. Device 2 navigates to “Receive” and presses the “”Pair with sender”.


  3. Complete the pairing process.



  4. Device 1 (Send) presses the start button.


  5. Device 2 (receive) presses start button, Directly after the button press, device 1 presses the “”Pair with sender” button


  6. Observe TCP connection never fully establishes (1.5 - 2 mins)

PLATFORM AND VERSION iOS

Development environment: Xcode 26.3, macOS 26.4.1

Run-time configuration: iOS 26.5

test project with a recording showing the issue: https://github.com/DeveloperNiels/WAIssue

Answered by DTS Engineer in 896013022
Yes I have managed to reproduced the issue even with the sample app.

OK. One way or another, that means that the problem is on our side of the fence. Please file a bug about this, and then post your bug number, just for the record.

In your bug report:

  • Include your steps to reproduce.
  • A sysdiagnose log from both devices in play, taken immediately after reproduce the problem.

See our Bug Reporting > Profiles and Logs page for more about sysdiagnose logs.

I have more info on filing Wi-Fi bug reports in Filing a Wi-Fi Bug Report, but I suspect that just a vanilla sysdiagnose log is sufficient in this case.

Share and Enjoy

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

Can you reproduce this with the Wi-Fi Aware sample code?

Share and Enjoy

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

Dear Quinn,

Yes I have managed to reproduced the issue even with the sample app.

How I reproduced the issue:

Step 1: Open app on both devices, device 1 selects "Host simulation", device 2 selects "view simulation" now pair both devices.

Step 2: Close app on both devices and start app again

Step 3: device 1 selects "Host simulation", device 2 selects "view simulation"

Step 4: Device 1 taps "advertise" and device 2 taps "discover & connect" both at the same time, and than you press the (+) sign as soon as possible on device 2. (leave the modal open for a few seconds).

Result: Stuck in connecting.

Killing the app and starting the app again (on both devices) does not resolve it the connecting issue. I only got it to work again after closing the app on both devices and leave the devices for a couple of minutes in idle. (I think NAN will close its underlying connection because its not being used for a while)

Also Device 1 will occasionally give a a error: "Listener Error" "Timed out. Tap Advertise to restart" Also tapping advertise again does not resolve it.

I added a recording (SampleCodeIssueReproduced.mp4) of how I reproduced the issue in the github repo: https://github.com/DeveloperNiels/WAIssue

In the first try I think I opened the pairing screen to soon, and you can see that the app worked as expected.

in the 2nd attempted I did manage to reproduce and they never connect.

Than I also closed the app and just try to get it working correctly again but even after closing the app they still don't manage to connect.

Yes I have managed to reproduced the issue even with the sample app.

OK. One way or another, that means that the problem is on our side of the fence. Please file a bug about this, and then post your bug number, just for the record.

In your bug report:

  • Include your steps to reproduce.
  • A sysdiagnose log from both devices in play, taken immediately after reproduce the problem.

See our Bug Reporting > Profiles and Logs page for more about sysdiagnose logs.

I have more info on filing Wi-Fi bug reports in Filing a Wi-Fi Bug Report, but I suspect that just a vanilla sysdiagnose log is sufficient in this case.

Share and Enjoy

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

Hi Quinn,

I just created the bug report, I hope I did it correctly and provided the necessary information.

Ticket: FB23509767

TCP connection in with Wi-Fi aware framework never reaches ".ready" state
 
 
Q