iPhone HTTP Server

前端 未结 4 1864
北荒
北荒 2021-02-03 15:39

Can someone give me simple code to help with creating an HTTP server for the iPhone. Something simple with much documentation would be appreciated. Anything you have please shar

相关标签:
4条回答
  • 2021-02-03 16:21

    Another open-source HTTP server for iPhone is the lightweight GCDWebServer which is built on top of Grand Central Dispatch. It's only a few source code files and offers a simple and extensible API.

    0 讨论(0)
  • 2021-02-03 16:21

    If you're unfamiliar with network programming your best bet is to first read Beej's Guide to Network Programming and then read the HTTP 1.1 spec before you look at source code (as you should have an understanding of the protocol before you start looking at implementations).

    A simple Google search turned up cocoahttpserver and iSpit. Otherwise, you could download Apache and look at its source code, but that's not exactly a simple implementation.

    0 讨论(0)
  • 2021-02-03 16:26

    There are sample codes from Apple and open source community such as cocoahttpserver TouchHTTPD.

    Here's a summary blog

    0 讨论(0)
  • 2021-02-03 16:30

    It is possible to run a simple file server on iPhone/iOS. I was able to use this method successfully. Here are the steps to create a simple file server which works on http protocol. 1. Install TestFlight app for iOS 2. Install iSH app from the Apple store or side load it from their website, as this app might not be available in the store depending on your country. I tried it from india in May 2020, and the app was not available in the store. So i did side load it from their website. 3. With iSH app, one has access to linux kernel of the iPhone. I did use a simple http server module from python and executed it on the linux shell. 4. Command to run the python based server on iPhone : Python -m http.server 8080 5. Access the file server using the local ip that’s assigned to the iPhone in the network you are connected to. That means, if iPhone is connected to a WiFi SSID, depending on whether the router is configured to use static IP address assignment based on MAC address or using DHCP protocol, your iPhone will have an internal IP assigned by the router. 6. Command to access the file server : http://192.168.1.3:8080 - modify the address depending on IP address of the iPhone and the port that server running on iPhone is configured to use. Paste this in a browser - one should be able to see the files listed in the directory where the server is running in.

    Hope this was clear enough, for running a simple http based file server on iPhone using http.server module in python, over linux shell of the underlying kernel, using iSH.

    0 讨论(0)
提交回复
热议问题