• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURLSession + Bonjour to do peer-to-peer file transfers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLSession + Bonjour to do peer-to-peer file transfers?


  • Subject: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • From: Eric Wing <email@hidden>
  • Date: Wed, 25 Dec 2013 07:26:42 -0800

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
      • From: Jens Alfke <email@hidden>
    • Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
      • From: Jens Alfke <email@hidden>
    • Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: Re: dataWithPDFInsideRect returns raster text
  • Next by Date: Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • Previous by thread: Re: NSArrayController + NSTableView addObject ends editing
  • Next by thread: Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • Index(es):
    • Date
    • Thread