iPhone HTTP Server

2019-03-11 19:41发布

问题:

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 share.

回答1:

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

Here's a summary blog



回答2:

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.



回答3:

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.