UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Network.framework connection / data transfer problem

Forums > Swift

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.

  1. I start the helper app on my Mac
  2. I start the ios app on my phone
  3. The iOS app discovers the mac using bonjour in this very second.
  4. I use the sing in function of the iOS app and the macOS app resonds with some mocked data
  5. 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?

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.