HTTP Communication
Now for the second part of this chapter – adding web server functionality to CocoaServer so that it can receive HTTP requests from its clients.
Writing a web server in Objective-C
CocoaServer advertises an HTTP service, so it needs to be able to accept HTTP requests. Then, clients, like Notified, can use NSURLConnection to exchange information with CocoaServer.
Writing a web server from scratch is not a task we can cover in this book. Instead, we have modified some of Apple’s sample code to lay the foundation of a web server in Objective-C. This code is available at http://www.bignerdranch.com/solutions/iOSProgramming.zip in the solution directory for the CocoaServer project.
The web server code is encapsulated in two classes: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access