We're using the Network.framework and send data between an iOS app and a macOS app using UDP. Works great.
For discovery we use bonjour.
So the flow goes like this.
- I start the helper app on my Mac
- I start the ios app on my phone
- The iOS app discovers the mac using bonjour in this very second.
- I use the sing in function of the iOS app and the macOS app resonds with some mocked data
- I can repeat this procedute an unlimited number of times. It work flawlessly until I take a 2-3 break.
I stop what I was doing and just hold the iPhone in my hand for 2-3 min. The iOS app is in foreground, screen unlocked. I can see the app.
I start at point 4 again - sing in. It doesn't work. In macOS debug log I see
The debug log of the macOS app says: 2020-12-01 22:40:40.274638+0100 Remote for Zoom[10750:497151] [] nwsocketgetinputframes [C4:1] recvmsg(fd 35, 9216 bytes) [61: Connection refused]
What's even more wired is I can switch the Wifi on the iPhone off and then turn it back on. The iOS app will instantly discover the Mac so it's not like there is no connection. It's there and it's instant. And yet after 2-3 min of inactivity on iOS side it's just a dead end.
What is this and how to heal it? Does the 2-3 min pause as symptom / trigger of the above error message ring some bells?