Is it possible to use NSURLSession + Bonjour to do peer-to-peer like file transfers? My example situation is that I have a Mac and iPhone. The iPhone has a generated file I want to copy over to the Mac through the wireless.
I can publish my iPhone via Bonjour and make my Mac discover and resolve the address. I try to create a NSURLSessionDownloadTask on my Mac and a NSURLSessionUploadTask on my iPhone. My DownloadSession (from Mac) connects to the advertised Bonjour service (iPhone). But when I create the UploadSession (iPhone), I get a NSErrorFailingURLStringKey. Networks are not my strong suit, so I really don’t know if I'm on the right path. (On the iPhone, I picked a random socket to advertise on. When I resolve it on my Mac and create the DownloadSession, it connects on that same port which triggers the iPhone to create an UploadSession. I originally tried using getpeername to reuse the same port, but also tried hardcoding a free port that both could connect to. Neither seemed to help.) I’m also a bit confused on how to convert NSNetService to NSURLs which can be fed to NSURLRequests for NSURLSessions. (I basically take the NSNetService hostName and port properties and generate a string of the form: "http://hostName:port/"). My eventual goal is to make this work with non-Apple devices too, e.g. a Mac pulls from an Android device instead of iPhone. So I was looking at NSURLSession because I assumed it used a standard protocol that would be easy to talk with on other platforms. Thanks, Eric -- Beginning iPhone Games Development http://playcontrol.net/iphonegamebook/ _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com