For my tvOS app I need to download a file at app startup which is around 500 Mb. With NSURLSession
it's an easy task to download large files directly to disk.
I'm able to download file pretty fast as per network profiler. Graph says I've got an average speed of around 6Mb per second during last 24 seconds.
So far so good. Another part of my application requires communication via custom NetService. So I'm preparing and posting the service:
self.service = [[NSNetService alloc] initWithDomain:@"local."
type:SERVICE_NAME
name:@"Remote receiver"
port:0];
[self.service publishWithOptions:NSNetServiceListenForConnections];
Publishing happens at 30th second of app's life. Upon service's didPublishMethod
I observe 2 changes in network profiler. First 2 new active TCP connections with state "Listening" for ipv4 and ipv6. The second one is surprisingly dramatic drop of download speed for the first active connection.
As you see after 30th second download speed decreased to couple of Kb/s.
The question is what's going on here? Does NSNetService
interfere with NSURLSession
? Why publishing of local service affects separate TCP connection? If resources shared between connection why does NSURLSession
's receive such a small share?