Professional Documents
Culture Documents
CSC8415 Assignment 1
Network Programming
Introduction
The assignment will be marked out of 100. This assignment is worth 30% of the marks for the course.
The assignment submission will have two parts, program code and a word processed report in PDF format.
The code goes into the Git repository, and the report will be submitted using the USQ Studydesk
assignment submission.
Assignment Topics
Recall that in assignment 0, you learned :The use of the Git repository.
The use of a makele.
C command line arguments.
Using pointers in C
Calling functions in C
Writing functions in C
Reading from and writing to les.
Encapsulation in C.
Conguration
Logging
In Assignment 1, you will build on everything you learned in assignment 0, and use it to perform professional quality network programming complete with error
handling. Specically, you will design and implement a networking client and a networking server, and they will communicate with each other.
Task Overview
1. Test the demonstration networking client that connects and communicates with a server.
2. Add command line arguments processing to the demonstration client so that you specify the address the port number, and the lename on the command line of
the client.
3. Improve the demonstration client by comprehensively implementing the missing error handling.
4. Test demonstration networking server that accepts connections from a client, and communicates with a client.
5. Implement conguration and logging for the server.
6. Improve the demonstration server by comprehensively implementing the missing error handling.
7. Design a protocol for a networking client and networking server to request and transfer les. The protocol should cover the circumstance where the server cannot
deliver the le, because, for example, the le may not exist.
8. Implement and test the designed networking server, complete with conguration and logging, that can accept the le name of a le from your client and deliver
the requested le.
9. Implement the networking client that can request a named le from the server as per your protocol design.
Script
The linux command line interface, called "bash", has a command "script" that will collect all the command line input and output. You will need to use this in order to
capture your testing for your report. Type
$manscript
in order to see the documentation for script. Here is a demonstration of script. Type the word "script". Then do things. Then when you are nished, type "exit", e.g.:
$scripttemp1
Scriptstarted,fileistemp1
$echohithere
hithere
$ls
BinCoursesmd5sum.txtPicturesSvnVbox
BioconDesktopMiscpoco1.7.3TempVideos
BioconOldDocumentsMntPublictemp1
bolwin10.7zDownloadsMusicSharedTemplates
$exit
Scriptdone,fileistemp1
Now you can view the output in a text editor, copy/paste into your report, or simply use the command "more" to see what you have captured, e.g.
$moretemp1
ScriptstartedonThu28Jul201611:30:55AEST
$echohithere
hithere
$ls
BinCoursesmd5sum.txtPicturesSvnVbox
BioconDesktopMiscpoco1.7.3TempVideos
BioconOldDocumentsMntPublictemp1
bolwin10.7zDownloadsMusicSharedTemplates
$exit
ScriptdoneonThu28Jul201611:31:07AEST
$
Part 1
The instructions posted on the home page show how to build the networking framework and how to install
it on your computer. Do this rst.
Then make a subdirectory "Part1" in the "Assignment1" directory within your Git repository. You will use
and improve the sample code from the provided networking framework. Copy all of the sample code,
including the makele and test.ini into "Part1".
Type "make" in order to build the sample code.
You need to read the documentation and modify your code to check for an error return. When you detect
an error return from a framework routine, you need to obtain the details of the error using an error
message method, which in this case is netCli_getErrMsg().
Then our command line window running the server should show:
$./netSrvDemo
Connectionfrom127.0.0.1
Gotline:"HelloWorld"
Part 2
You will design and implement a client and server where the client requests a le from the server, and the
server sends the le to the client, if it can.
Take special care of your handling of binary les. Your call to fdopen(), if you use fdopen(), should use the
string "r+b". Binary les are not line based, and cannot be written a line at a time.
It may well be better to implement the server rst, as it may be tested using a telnet client before your
purpose built client has been built.
$getFileCli127.0.0.19991myfile.txt>myfile.txt
Error:Serversaysfiledoesnotexist.
Modify the client in order to implement your design. Your client should be of professional quality, complete
with error handling.
TwitterFacebook
Youtube
LinkedIn
Instagram
Pinterest
Google+