Women in Technology

Hear us Roar

  How to Write a Cocoa Web Server
Subject:   Why not NSStreams ?
Date:   2006-12-03 11:54:36
From:   sourbox
Apple has a CocoaHTTPServer sample, located at http://developer.apple.com/samplecode/CocoaHTTPServer/index.html .
Any advantage using your method instead of the Apple way ?
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Why not NSStreams ?
    2006-12-04 00:52:59  JürgenSchweizer [View]

    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.