Runloop Chatter Server

GUI applications aren’t the only ones that can benefit from being runloop-driven. Here you will make some changes to chatterserver so that it uses a runloop at its core rather than select(). You’ll perform some surgery to existing functions and add some new ones. There won’t be any changes to the fundamental data structures or architecture of chatterserver. While the behavior of the server won’t change, the changes you do make will set the stage for adding Bonjour support in a later chapter.

Make a copy of chatterserver.m and name it chatterserver-runloop.m. The first thing to change is the signature and the first several lines of AcceptConnection. The runloop will call accept() for us, so all we need to do is get the ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.