Re: backgrounding a udp socket
Re: backgrounding a udp socket
- Subject: Re: backgrounding a udp socket
- From: Adam Kaplan <email@hidden>
- Date: Thu, 10 Sep 2015 21:39:42 -0400
There is already support for backgrounded network connections via NSURLSession. I would stay within the process provided by NSURLSession and try not to subvert it.
It sounds like what you want is to model the behavior of your proprietary UDP protocol in an NSURLProtocol subclass. Once your protocol handler is properly registered (via +registerClass), you should be able to use vanilla NSURLSession background task methods to do what you want.
These might help:
http://nshipster.com/nsurlprotocol/
https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSURLProtocol_Class/index.html
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/UsingNSURLSession.html
Disclaimer: I have written iOS UDP clients & servers, and done background networking, but never both at the same time :)
— adam
On Thursday, September 10, 2015 at 7:32 PM, Michael Brian Bentley wrote:
> Is it possible to set up a udp socket via a background task using
>
> -beginBackgroundTaskWithName:expirationHandler:
>
> (or something like it) such that we're able to continue receiving
> datagrams while the app is backgrounded?
>
> -Mike
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list (email@hidden (mailto:email@hidden))
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden (mailto:email@hidden)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden