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 (Macnetworkprog@lists.apple.com 
> (mailto:Macnetworkprog@lists.apple.com))
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/macnetworkprog/adkapx%40gmail.com
>  
> This email sent to adk...@gmail.com (mailto:adk...@gmail.com)  



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to