ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  How to Write a Cocoa Web Server
Subject:   Why not NSStreams ?
Date:   2006-12-04 00:52:59
From:   JürgenSchweizer
Response to: Why not NSStreams ?

Apple's sample code is actually much more low level than ours. It uses the call back mechanism of the Core Foundation function CFSocketCreate to accept new connections. Only later is the call back converted to a method invocation and a pair of NSStreams is created from a native BSD socket using CFStreamCreatePairWithSocket. While the use of CFSocket and CFStream is more flexible, our emphasis has been on simplicity. In fact, I believe that the code discussed in this article shows the simplest way to implement a basic HTTP server on Mac OS X.