As before, the best choice is to use a third-party library for this. There are basically two libraries for doing this work: CocoaHTTPServer and MongooseDaemon .
Both of them have an Objective-C API, but MongooseDaemon is just a Mongoose HTTP server shell written in plain c, while CocoaHTTPServer is completely written in Objective-C.
We decided to go with CocoaHTTPServer for a few simple reasons:
- Even the simplest property, such as setting the document directory for the HTTP server, does not exist in MongooseDaemon. You must change the
#define in the included source file to be able to change it by default, which indicates NSHomeDirectory() . - The MongooseDaemon library currently contains warnings about deprecated methods used in the Objective-C shell.
- CocoaHTTPServer knows things like Bonjour or WebDav, while Mongoose just provides the basics.
- CocoaHTTPServer comes with many examples that range from simple HTTP servers, passwd, SSL / TLS, or WebDav HTTP server.
- CocoaHTTPServer works with GCD to enable multithreading.
CipherCom Aug 05 2018-12-12T00: 00Z
source share