Post

Replies

Boosts

Views

Activity

Reply to NWConnection: how to recover data connection after RF cellular data connection loss
Yes, making the reference to a single object explicit might help prevent some unexpected issues. However, that is not any root cause for the present query. My main and original query remains: How does iOS, especially NWConnection(), notify about re-availability of a RF network after a connection got in state .failed (terminal state without any further connection notification)? This is an essential stage before making reconnection try using a new connection. In other words, how does one monitor the RF network availability? Is this information provided by any NWConnection() API or not? If not, what's the best API to use? NWPathMonitor()?
Sep ’25
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
OK, that"s what I've supposed. The state .failed is terminal. This is why I've implemented the re-connection with setupUDPConnection(). However, I'm not quite sure from where to recover. Here's my condensed implementation of setupUDPConnection(): self.connection.cancel() let udp = NWProtocolUDP.Options.init() udp.preferNoChecksum = false let params = NWParameters.init(dtls: nil, udp: udp) params.serviceClass = .responsiveData connection = NWConnection(host: NWEndpoint.Host.name(AppConstant.Web.urlWebSafeSky, nil), port: NWEndpoint.Port(rawValue: AppConstant.Web.urlWebSafeSkyPort)!, using: params) connection.stateUpdateHandler = { (newState) in switch (newState) { case .ready: self.receiveUDPConnection() break case .setup: // Nop break case .cancelled: // Nop break case .preparing: // Nop break case .waiting(let error): // Nop break case .failed(let error): // Cancel present connection // break default: break } self.handleStateChange() } connection.start(queue: queue)` But the connection using the same NWConnection instance (self.connection) does not succeed. Possibly, because the network reception is still weak. How does one get informed about re-availability of the RF network connection in order to start the above mentioned setupUDPConnection()?
Sep ’25
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
Hey Quinn, Thanks for your feedback. Yes, the connection has to go via cellular network as the users are on the road. Refering to your mentioned steps: first connection enters the .failed(…) state once in poor reception area. This works perfect. No further states are reported any more for the same connection. Here's a trace of the states and error codes from 1st connection onwards: ... celluar network available ... [20:49:47.GMT+2] [NetworkManager:setupUDPConnection(lat:lon:):43 5] UDP in .preparing, available Interfaces: [pdp_ip0] --> OK [20:49:54.GMT+2] [NetworkManager:setupUDPConnection(lat:lon:):42 3] UDP in .ready, available Interfaces: [pdp_ip0] --> OK ... celluar network loss ... [21:15:12.GMT+2] [NetworkManager:setupUDPConnection():44 2] UDP in .failed: 57 The operation couldn't be completed. (Network.NWError error 57 - Socket is not connected), available Interfaces: [pdp_ip0] --> OK, state .failed [21:15:12.GMT+2] [NetworkManager:receiveUDPConnection ():912] Optional (unsatisfied (No network route)):The operation couldn't be completed. (Network.NWError error 57 - Socket is not connected) --> OK, state .failed (on downlink) [21:15:12.GMT+2] [NetworkManager:sendADSLdata():778] unsatisfied (No network route):POST beacons The operation couldn't be completed. (Network.NWError error 57 - Socket is not connected) --> OK, state .failed (on uplink) ... celluar network available (again) ... Even though the cellular network is available again (confirmed by load of a web site from within the app), the network state remains in .failed, and does not get updated anymore. So, the question is: should connection.stateUpdateHandler report a state update even a connection state previously turned .failed? You've mentioned the connection state should return to .ready under recovery of a strong network availability. This isn't the case. Is this already an origin of the issue?
Aug ’25
Reply to swift-frontend memory usage
The issue is still present in XCode 13.2 Final Release. This is a show stopper! Apple Devs, please soon fix the issue. Xcode is useless since 2 months. My project does not build anymore, neither with simulator or real device. Analysing the project does not work neither. Automatically running background tasks e.g. for Canvas prevent from continued software development (without user triggered build functionality). RAM memory consumption grows up to 100 GB and more. Included Swift packages compile correctly, but compilation of own modules lasts for ever in dead loop without compilation warning. There's some long lasting background build activity, if patient, the build process may finish (before the MBP resets). This behaviour is non deterministic: I've experienced the same project may compile/run after a build folder clean without any code change. I was somehow lucky to first progress with XCode 13.2 RC (13C90), but the local workaround does not work anymore. Please help out.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
Yes, making the reference to a single object explicit might help prevent some unexpected issues. However, that is not any root cause for the present query. My main and original query remains: How does iOS, especially NWConnection(), notify about re-availability of a RF network after a connection got in state .failed (terminal state without any further connection notification)? This is an essential stage before making reconnection try using a new connection. In other words, how does one monitor the RF network availability? Is this information provided by any NWConnection() API or not? If not, what's the best API to use? NWPathMonitor()?
Replies
Boosts
Views
Activity
Sep ’25
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
OK, that"s what I've supposed. The state .failed is terminal. This is why I've implemented the re-connection with setupUDPConnection(). However, I'm not quite sure from where to recover. Here's my condensed implementation of setupUDPConnection(): self.connection.cancel() let udp = NWProtocolUDP.Options.init() udp.preferNoChecksum = false let params = NWParameters.init(dtls: nil, udp: udp) params.serviceClass = .responsiveData connection = NWConnection(host: NWEndpoint.Host.name(AppConstant.Web.urlWebSafeSky, nil), port: NWEndpoint.Port(rawValue: AppConstant.Web.urlWebSafeSkyPort)!, using: params) connection.stateUpdateHandler = { (newState) in switch (newState) { case .ready: self.receiveUDPConnection() break case .setup: // Nop break case .cancelled: // Nop break case .preparing: // Nop break case .waiting(let error): // Nop break case .failed(let error): // Cancel present connection // break default: break } self.handleStateChange() } connection.start(queue: queue)` But the connection using the same NWConnection instance (self.connection) does not succeed. Possibly, because the network reception is still weak. How does one get informed about re-availability of the RF network connection in order to start the above mentioned setupUDPConnection()?
Replies
Boosts
Views
Activity
Sep ’25
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
Hey Quinn, Thanks for your feedback. Yes, the connection has to go via cellular network as the users are on the road. Refering to your mentioned steps: first connection enters the .failed(…) state once in poor reception area. This works perfect. No further states are reported any more for the same connection. Here's a trace of the states and error codes from 1st connection onwards: ... celluar network available ... [20:49:47.GMT+2] [NetworkManager:setupUDPConnection(lat:lon:):43 5] UDP in .preparing, available Interfaces: [pdp_ip0] --> OK [20:49:54.GMT+2] [NetworkManager:setupUDPConnection(lat:lon:):42 3] UDP in .ready, available Interfaces: [pdp_ip0] --> OK ... celluar network loss ... [21:15:12.GMT+2] [NetworkManager:setupUDPConnection():44 2] UDP in .failed: 57 The operation couldn't be completed. (Network.NWError error 57 - Socket is not connected), available Interfaces: [pdp_ip0] --> OK, state .failed [21:15:12.GMT+2] [NetworkManager:receiveUDPConnection ():912] Optional (unsatisfied (No network route)):The operation couldn't be completed. (Network.NWError error 57 - Socket is not connected) --> OK, state .failed (on downlink) [21:15:12.GMT+2] [NetworkManager:sendADSLdata():778] unsatisfied (No network route):POST beacons The operation couldn't be completed. (Network.NWError error 57 - Socket is not connected) --> OK, state .failed (on uplink) ... celluar network available (again) ... Even though the cellular network is available again (confirmed by load of a web site from within the app), the network state remains in .failed, and does not get updated anymore. So, the question is: should connection.stateUpdateHandler report a state update even a connection state previously turned .failed? You've mentioned the connection state should return to .ready under recovery of a strong network availability. This isn't the case. Is this already an origin of the issue?
Replies
Boosts
Views
Activity
Aug ’25
Reply to swift-frontend memory usage
The issue is still present in XCode 13.2 Final Release. This is a show stopper! Apple Devs, please soon fix the issue. Xcode is useless since 2 months. My project does not build anymore, neither with simulator or real device. Analysing the project does not work neither. Automatically running background tasks e.g. for Canvas prevent from continued software development (without user triggered build functionality). RAM memory consumption grows up to 100 GB and more. Included Swift packages compile correctly, but compilation of own modules lasts for ever in dead loop without compilation warning. There's some long lasting background build activity, if patient, the build process may finish (before the MBP resets). This behaviour is non deterministic: I've experienced the same project may compile/run after a build folder clean without any code change. I was somehow lucky to first progress with XCode 13.2 RC (13C90), but the local workaround does not work anymore. Please help out.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21