ENN523 Advanced Network Engineering Assignment Part 1: TCP/IP Communications via Socket Programming Version 1.0 on 16 March 20161. Introduction This assignment of TCP/IP communications is a group-of-t
ENN523 Advanced Network Engineering Assignment Part 1: TCP/IP Communications via Socket Programming Version 1.0 on 16 March 20161. Introduction This assignment of TCP/IP communications is a group-of-t
ENN523 Advanced Network Engineering Assignment Part 1: TCP/IP Communications via Socket Programming Version 1.0 on 16 March 2016
1. Introduction This assignment of TCP/IP communications is a group-of-two assignment worth 15% though
working alone without a group is also acceptable. It will require Socket Programming, which is the topic of Week04 Lecture and Week05 Tutorial. Sections 1 through 3 introduce some background information relevant to the assignment. The assignment tasks are described in Section 4. Section 5 highlights what and where you need to hand in your project report. In Section 6, the marking scheme of the assignment is enclosed for your reference. This assignment relates to the following unit outcomes described in the unit outline:
Outcomes: 2. Advanced collaborative and communication skills through a group project and a technical report; and 4. Advanced collaborative and communication skills through a group project and formal technical report. The criteria and performance standards used in this assessment are described in a table at the end of this document. Use the table as a marking guide. You are asked to self-assess your assignment (in the enclosed marking guide table) and reflect on what you have achieved before handing in your assignment report. This gives you the opportunity to reflect on what you have learned from this assignment and also what you need to improve. For self-assessment, submit the self-assessed sheet together with your assignment. The self-assessment sheet is the table at the end of this document, and is used as a Criteria Referenced Assessment (CRA) marking guide. For reflection, write a separate section of Reflection at the end of your assignment report. Key technical aspects that this assignment is addressing include: TCP/IP communications, socket
programming, timing control, and round trip delay. Non-technical aspects of the assignment include: team work, organization and presentation of report (communications), and reflection.
2. Background: Dealing with Time There are basically three types of methods to deal with time in C programming: (1) Use some well-developed timing control APIs. For example, in Windows, a few functions are implemented in windows library (header file: windows.h); and QueryPerformanceCounter() can be used for high-resolution timing control. This is the
method we have used in our examples, and is recommended to you for this assignment. (2) Using the standard time library. The standard time library provides a number of functions for time operations, e.g., time(), localtime(), etc. Find a book or search the Internet to learn how to use this time library.
2 (3) Using hardware timer interrupt, which is the highest hardware interrupt. In this assignment, you do not have to use this method. For Linux users, sys/time.h declares a few time functions for high-resolution timing control, e.g., gettimeofday(). If anyone is interested in good timing control and clock synchronization over networks, our recent research paper on this topic will give you some ideas: http://eprints.qut.edu.au/73370/. The paper is published in Journal of Network and Computer Applications, vol. 44, pp. 63-71, 2014.
3. Background: Socket Programming
What is a “network socket”? A socket is a way to talk to other programs using the standard (Unix) file descriptors. A file descriptor is simply an integer associated with an open file; and the file can be a network connection! Where to get this file descriptor for network communication? Call the socket() system routine. Then, send() and recv() and other socket calls can be used to talk to other computers. In this assignment, we deal with TCP socket only although other sockets are also available, e.g., UDP.
For a basic yet still comprehensive description on socket programming in C, refer to Beej’s guide to Network Programming using Internet Socket (http://beej.us/guide/bgnet/). The guide is for unix/linux programming; however it also has a section for Windows programmers.
4. Assignment Tasks You are asked to develop a Server (program) running on one computer, and a Client (program) running on another computer. The structure of the client-server system is shown below in Figure 1. The Server accepts input from keyboard for command and instructions, displays information on the monitor, sends commands or other messages to the Client, and receives information from the
Client.
When you test your server and client programs on one computer, you may use Loopback IP Address
127.0.0.1, with which any packets sent out from this machine will immediately loop back to itself.
Figure 1: A client-server system including a server and two clients. Assignment tasks are described below: (1) When the Server is started, it initializes the settings of the server’s IP addresses, port
number, and the client’s IP address, etc., through hard-coded header file, keyboard input, command window arguments to main(), or reading from a text file; (2) Every three seconds, the Server sends a command to the Client to ask for data, e.g., through
a single letter “R” or “r” (request); (Timing control is required here. Using our examples in
Server
Keyboard
Monitor
TCP/IP
Client Monitor
Keyboard
3
the lecture/tutorial materials if you like.) (3) After receiving the command from the Server, the Client sends back to the Server a random integer number between 0 and 100 with uniform distribution. The Client may also display some useful information on its monitor. (Use a random generator to generate such
random numbers. For example, rand()%101 and use srand(time(NULL)) to get a seed for
rand(), where time() function is defined in header file time.h); (4) The Server receives the random integer (between 0 and 100) from the Client, displays the integer on its monitor, and sends to the Client the Server’s current time (hh:mm:ss:ms-) as an ACK; (5) The Client calculates the round trip delay from its communications with the Server, and displays the result on its monitor; and (6) The Server reads in various commands and instructions from the keyboard. An obvious command is to terminate the Server program, e.g., using a single letter “E” or “e” (exit). When the Sever is to be terminated, the Server should also notify the Client of the Server’s termination. Then, the Client terminates the client program as well.
How to test your programs:
(1) At early stages of your program development, you may test your programs on a single
computer. Execute the Server program in one command window, and execute the Client
program in another command window. Both the Server and Client share the same IP
address, e.g., the Loopback IP address 127.0.0.1.
(2) If you test your programs in computer labs, you may execute the Server and Client
programs on two different computers, which have different IP addresses.
5. Where and What to Hand in Submit your assignment to me via email (y.tian@qut.edu.au) with the following items: (1) A report on your design, solutions, testing and discussions, other related issues. We will discuss in class what the report should look like. a. The report should start with a cover page, followed by an Executive Summary of no more than 1 page, and Table of Contents. Then, the report has the main body text, references if any, and your reflection. b. The body text could be organized with the following components: background of the project (e.g, main requirements and functions, etc), system design and logic flows at a high level (which is independent of any programming languages), implementation of the main components of the system (this may be programming language dependent), test plan and testing results, conclusion, and references if any. c. The report should be less than 20 A4 pages in 12pt font size for the body text. Additional materials that you feel important could be organized in an appendix. d. The report is expected to have a Reflection Section, which discusses what you have learned from this unit or this assignment, what you feel is beneficial to you, and what aspects you think you need to improve. In the reflection, each of the assignment group members is expected to write a paragraph; and an additional paragraph for the group is
optional. Be specific about yourself and the unit/module. (2) A zipped file of your c/c++ source files, header file/s, data file if any, and readme file if not in c/c++; do NOT submit any project files (Note: submitting those project files will attract penalty marks of 1%); and (3) A copy of your self-assessment sheet should be attached as a separate sheet.
6. Marking Guide Criteria Referenced Assessment (CRA) marking guide is enclosed, which is also used as a selfassessment sheet.
4
ENN523 Advanced Network Engineering: TCP/IP Communications Assignment, S1 2016. Criteria Referenced Assessment (CRA) Marking Guide & Self-Assessment Sheet
Student1 Name:______________________ Student1 No.: ______________ Student2 Name:______________________ Student2 No.: ______________
Element Wt
% 100-85 84-75 74-65 64-50 46-20
Selfassessed
marks
Weighted
selfassessed
grade
Marker’s
marks
Weighted
Marker’