• 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
Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Wed, 25 Dec 2013 11:15:18 -0600

NSURLSession is a fancy HTTP client. It needs to talk to an HTTP server.
None of the included iOS and OS X frameworks (that I'm aware of) include an
HTTP server.

You can either run an HTTP server on the device in your app (
https://www.google.com/search?q=ios+http+server) or you can write your own
protocol and implement it.


On Wed, Dec 25, 2013 at 9:26 AM, Eric Wing <email@hidden> wrote:

> 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
_______________________________________________

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: Eric Wing <email@hidden>
References: 
 >NSURLSession + Bonjour to do peer-to-peer file transfers? (From: Eric Wing <email@hidden>)

  • Prev by Date: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • Next by Date: Re: Sandboxing: Can't bookmark enclosing folder of user-selected file
  • Previous by thread: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • Next by thread: Re: NSURLSession + Bonjour to do peer-to-peer file transfers?
  • Index(es):
    • Date
    • Thread