11

I want to create an App that can share files between other iOS devices and potentially also Desktop computers.

So what I want to do is run a lightweight web server on my device that allows to download files from the device like so:

http://myphone.local:1234/folder/samplefile.txt

How can I provide such a server on a non-jailbroken device. I would prefer not to write a server like this from scratch :-).

Thanks a lot for your help

Besi
  • 22,579
  • 24
  • 131
  • 223

2 Answers2

18

Take a look at Cocoa HTTP Server

Nathan
  • 6,772
  • 11
  • 38
  • 55
tilo
  • 14,009
  • 6
  • 68
  • 85
  • Thanks for pointing this out one out. I guess I've stumbled upon it some while back. It definitely looks promising – Besi Dec 07 '11 at 15:14
  • Sure I'll do this, bug I need to test it first. – Besi Dec 07 '11 at 16:05
  • Does Apple Approve this cocoaHTTPServer, if i make use it in my App? Couple of days back my App is rejected by Apple for making use of RoutingHTTPServer. – Madhu Aug 12 '15 at 06:23
3

According to the GitHub project:

CocoaHTTPServer is a small, lightweight, embeddable HTTP server for Mac OS X or iOS applications.

Sometimes developers need an embedded HTTP server in their app. Perhaps it's a server application with remote monitoring. Or perhaps it's a desktop application using HTTP for the communication backend. Or perhaps it's an iOS app providing over-the-air access to documents. Whatever your reason, CocoaHTTPServer can get the job done.

Spike0xff
  • 1,246
  • 1
  • 15
  • 24
Foo
  • 596
  • 2
  • 5
  • 21