Mac OS X Reference Library Apple Developer Connection spyglass button

Version: 1.2

Posted: 2005-07-26

Build Requirements: Xcode 1.5 or later

Runtime Requirements: Mac OS X

View Source Code:

Download Sample Code (“CFLocalServer.zip”, 117.4K)



Description

CFLocalServer is a sample that shows how to use UNIX domain sockets to communicate between client and server programs running on the same machine. This sample was written specifically to show how a daemon can manage communication with multiple clients. It supports RPC communications (where the client makes a request to server and blocks waiting for a reply) and asynchronous notification (where the server sends messages to all clients). It wraps each UNIX domain socket in a CFSocket to demonstrate the integration of UNIX domain sockets with a run-loop based program.

CFLocalServer should work on all versions of Mac OS X, but it has been primarily tested on Mac OS X 10.4.x.

Document Revision History

Date Notes
2005-07-26This sample code has been updated to include a project (for Xcode 2.1) to produce a universal binary and there were no code changes required for it to run correctly on the Developer Transition Systems.
2005-07-05Corrected a bug where the packet's fID field wasn't being initialised in the RPC case.
2005-06-01Uses UNIX domain sockets to communicate between client and server programs on the same machine.
Did this document help you? Yes It's good, but... Not helpful...