Daytime Server (RFC867) HowTo

How To Install a Daytime Server The Easy Way on your Mac

Ever wondered how to get a simple server running on your mac? Here is how:

We use RFC867 as example protocol for our simple test server. This is the so called daytime protocol, for which the server just returns the actual time of day to a request of a client.

This daytime protocol is readily implemented by the Boost.ASIO library, that provides C++ examples for both the daytime

Supposed we have compiled the server as “boost_daytime_server” (follow the instructions given on boost.org → Getting Started), we copy it into /usr/local/bin and launch the daytime server with the following plist file “my_organization.daytime.plist” in “/Library/LaunchDaemons”:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <string>Daytime Server with Boost</string>

Then we load the daytime service into Mac OS X:

sudo lauchctl load /Library/LaunchDaemons/my_organization.daytime.plist

A running daytime server, as described in the above boost tutorial, is available at schorsch.efi.fh-nuernberg.de. You can test your client with it:

./client schorsch.efi.fh-nuernberg.de

The output of the above command should be something like that:

Tue Apr  9 08:15:20 2013