> On May 3, 2017, at 9:38 AM, Jeff Kelley <slauncha...@gmail.com> wrote: > > Hi all, > > I’m writing an app that begins a NetService on tvOS and connects to it > from iOS. I’m creating the service with a port number of 0 to get an > automatic port and publishing with the .listenForConnections option. On the > client (iOS) side, once I resolve an address for the service I use its > getInputStream(_:outputStream:) method to get input and output streams set > up. I create a background thread to handle callbacks on and schedule the > streams on its RunLoop. > > What I’m noticing is that I get a lot of stream errors with this setup. > I’m using JSONSerialization to write JSON objects to the stream and for the > most part it works, but when I get these errors I’d like to reconnect. It > seems like I can’t just call getInputStream(_:outputStream:) again on the > resolved service, as doing so gives me all kinds of errors about a socket not > being available. My next thing to try will be to rediscover the service, > using its TXT data to make sure it’s the same one, re-resolve the address, > and try again. > > I’m pretty new to Bonjour and there aren’t a whole lot of resources out > there for how to handle stream errors. Am I on the right track? What kind of > gotchas should I be aware of here (for instance, is there a hard number of > clients that could conceivably connect to a NetService on an Apple TV)?
Hi Jeff, I'm not sure why you're getting stream errors but after the failure you might try creating a fresh copy of the NSNetService and then try grabbing new streams from that. -Marc > Thanks in advance for any pointers! > > > Jeff Kelley > > slauncha...@gmail.com <mailto:slauncha...@gmail.com> | @SlaunchaMan > <https://twitter.com/SlaunchaMan> | jeffkelley.org <http://jeffkelley.org/> > > (Cross-posted from cocoa-dev, sorry for the noise to those who get this > twice!) > _______________________________________________ > 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/marc%40apple.com > > This email sent to m...@apple.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