June 28th 2014, Installing a Test Server
← June 25th 2014 QTcpSocket State | ● | July 7th 2014 Installing the Pong Server →
After numerous small improvements and local tests of the transmission protocol, the project is ready for the first mile stone: Setting up a test server to listen on port 10000 for incoming transmissions. I am using my private Mac Mini MacOS X Server to install the project’s software.
In order to get a web service running on Mac OS X server, we need to add it to “launch control”. This is the system process which starts all other daemon processes during startup or on demand, for example, if tcp packets are arriving on a particular port.
First we use RFC867 as an example protocol for a simple test server. This is better known as the so called daytime protocol (on tcp port 13), for which the server just returns the actual time of day as a response.
This daytime protocol is readily implemented by the Boost.ASIO library, which provides C++ examples for both the daytime
Supposed we have compiled the server as “boost_daytime_server” (following the instructions given on boost.org → Getting Started), we copy it into /usr/local/bin and launch the daytime server by installing the following plist file “org.open-terrain.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"> <dict> <key>Debug</key> <false/> <key>GroupName</key> <string>staff</string> <key>Label</key> <string>org.open-terrain.daytime</string> <key>OnDemand</key> <false/> <key>Program</key> <string>/usr/local/bin/boost_daytime_server</string> <key>ServiceDescription</key> <string>Daytime Server with Boost</string> <key>UserName</key> <string>root</string> </dict> </plist>
Then we load the daytime service into Mac OS X launch control:
launchctl load /Library/LaunchDaemons/open-terrain.daytime.plist
A running daytime server, as described above, is available at schorsch.efi.fh-nuernberg.de. We can test our daytime 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
Testing the server can also be achieved with the telnet tool:
telnet schorsch.efi.fh-nuernberg.de 13
This yields the following output:
Trying 141.75.33.13... Connected to schorsch.efi.fh-nuernberg.de. Escape character is '^]'. Sat Jun 28 13:04:44 2014 Connection closed by foreign host.
← June 25th 2014 QTcpSocket State | ● | July 7th 2014 Installing the Pong Server →