(c) 2011-2013, Rune Hylsberg Jacobsen, Aarhus University School of Engineering.
Version 0.3, date 2013-11-14.
This workshop is concerned with the implementation of a client and a server for the Time Protocol specified in RFC 868 (STD 026) using the socket application program interface (API).
There are no requirements regarding the programming language (e.g., Perl, C, C++, Java etc.) used to implement the client and server applications. The client and the server are required to run on the Linux machines and must be implemented for the UDP-based service and the TCP-based service. Make sure that your timestamp is compliant with the examples in RFC 868.
Note, that the virtual hosts of VNE comes with a perl intepreter installed, and that the use of an intepreted language makes it easier to modify the program on the target in VNE.
Optional and not a mandatory part of the workshop:
The advanced student may wnt to implement one of the following features in addition to the pure client-server communication.
The socket concept is a client-server paradigm and a model of the interaction between applications running over a network. The socket API, that applications can use to access the TCP/IP protocols, is described in Comer Chapter 21. The book chapter also includes an example of a client and server implementing the TCP-based whois service specified in RFC 954. An example of an echo client and server from the book Computer Networks and Internets (also by Comer) written in C is also available for inspiration.
A example of a Perl implementation of a client and a server program is given in an appendix below.
Each group is required to test their time protocol implementation (i.e., both client and server) against at least two independent implementations made by other groups. Each group must therefore advertise the location of their client and server applications (not the source code) with instructions on how to run it such that they can be executed by the other groups. This informations must be available from the course web pages in Campusnet using the "Student" folder in the File Sharing function.
The client and the server is required to take command-line arguments as specified below:
tpudpclient <serverhost> <port>
tptcpclient <serverhost> <port>
Note, that the time on a Linux system can be changed by issuing the following command with root privileges:
date -s "01/01/1970 00:00:00"
Use Wireshark to identify the exchange of timestamps between the server and the client. Is the payload size in the packet 32 bit (4 bytes) as specified in RFC 868?
Possible Perl functions to consider: localtime, pack, unpack
The project must be documented in a short report of no more than two pages (excluding source code). The report should contain the following elements:
Reports should be emailed in pdf or ascii format to email@example.com.
Historically, network sockets is a Berkeley UNIX mechanism of creating a virtual duplex connection between processes. This was later ported on to every known operating systems enabling communication between systems across geographical location running on different OS software. If not for the socket, most of the network communication between systems would never ever have happened.
A typical computer system on a network receives and sends information as desired by the various applications running on it. This information is routed to the system, since a unique IP address is designated to it. On the system, this information is given to the relevant applications which listen on different ports. For example a net browser listens on port 80 for information. Also we can write applications which listen and send information on a specific port number.
For now, let's sum up that a socket is an IP address and a port, enabling connection.
Below is a simple client and a simple server program written in Perl. This is followed by a short example on how to use command-line arguments in Perl. The program examples main be found in sharedLAB area. Following each program example a short description of the programs are given.
To explain the socket we will take an example of client-server Programming. To complete a client server architecture we would have to go through the following steps:
This simple server can run just on one machine that can service only one client program at a time connecting from the same or a different machine. Recall that the steps for creating a server were to create a socket, bind it to a port, listen at the port and accept client connections.
Program is run like this:
perl -w server0.pl
SERVER started on port 7890 The server is now listening at port 7890 on the local host, waiting for clients to connect.
The function getprotobyname() requires the Linux file /etc/protocols to associate protocol names with numbers. For this workshop the following entries are needed when you use the VNE for testing:
tcp 6 TCP # transmission control protocol udp 17 UDP # user datagram protocol
In addition, the VNE hosts need to be configured to use the /etc/hosts for name resolution since we do not have a running DNS service. To allow hostname resolution you may configure /etc/host.conf as follows:
order hosts, bind multi on
A /etc/hosts file could look something like the following, but needs of course to be adapted to your test setup.
127.0.0.1 localhost 10.0.0.1 theclient 10.0.0.2 theserver
The example below shows how to capture command line arguments in Perl.