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
Whether you're learning web development and want to host your own HTML files on your iPhone, or whether you just want to play around with a server without being restricted to using a laptop or a computer to install MAMP, your iPhone can do it for you.
Want to run a simple web server off of an iPad or iPhone? If you have iSH linux shell running in iOS then you can easily start and run a simple web server directly from an iPhone or iPad.
Accessing localhost from the iPhone will simply do a loopback / try to connect to itself (If it supports that?). What you need to do is find the IP of your desktop machine (e.g. If Windows, go to the Command Prompt and type ipconfig or go to Network and Sharing Centre and look up connection status .
Take a look at Cocoa HTTP Server
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With