Csc8415 computer network programming - compile and run your


The task is to create a webserver.

The files are attaches with the mail. The files contain a server.c file which is a working file we have to modify netSrvDemo.c and use telnet to test it.

Assignment Topics

Recall that in assignment 0, you learned :-
- The use of the Git repository.
- The use of a makefile.
- C command line arguments.
- Using pointers in C
- Calling functions in C
- Writing functions in C
- Encapsulation in C.
- Configuration
- Logging
- Error handling
In Assignment 1, you will build on everything you learned in assignment 0. In addition to the above, you will learn :-
- Accepting TCP connections.
- Reading from TCP connections.
- Writing to TCP connections.
- Parsing HTTP text.
- Sending HTTP text.
- Opening and reading from file.
- Write a TCP server.
About this assignment
CscNetLib
You will use CscNetLib networking library, beginning with the demonstrations in the Samples directory. You need to obtain the latest version of CscNetLib (i.e. version 1.9.0). The version number of the library exists in the file "std.h". Build it and install it, before attempting the assignment.

Network Framework Documentation
The documentation for CscNetLib routines exists in the network framework header files, and you will need to read these carefully in order to complete the work in this assignment.

For example, if you want to know just what a given netCli_???() routine does, and what the return value is, you will find the documentation for the routine immediately before the prototype for that routine in the file "netCli.h" in the place where you installed it.
If you get stuck
If you are stuck at any stage which is likely then seek help on the forums. Hopefully someone has already had the same problems as yourself, and you can read the solution in the forums. If not, then you need to ask.
Develop a bit at a time.
It is good practice, and in this course your marks depend on it. You need to plan your delta (small improvement) so that your increment can be tested. Get the delta working and test that before moving on.
You MUST check your work in with Git
You need to check your code into the Git repository provided for this course (NOT GitHub), and push it to the server regularly. This is good practice normally, and in this course your marks depend on it. There are marks associated with your report, but failure to check in your code regularly will incur the loss of the marks associated with the code. Code with no development history is worth zero marks.
Checked into the correct place
You may need to make a new directory in your Git repository called "Ass1", and it will have subdirectories within that directory as needed.
Quality code
The student is expected to produce quality code. The code should be:-
- Consistently formatted throughout using Horstmann, Allman or K&R indent style , with Allman being preferred.
- Block commented.
- Not use many global variables.
- Use modules (functions).
Testable on Linux
Your marker will inspect, compile and run your code on the Linux operating system as provided for this course. If it does not work on the linux test machine then the marker will say that it does not work.
It builds using make

The marker will go to the directory associated with the question and inspect the code. He or she will type the command "make" in order to compile the program.
No errors or warnings

Errors mean that it does not work, but compiler warnings will cost marks. Compiler warnings are usually an indication of something not being done correctly. If you cannot ascertain the cause of a compiler error or warning, then seek help in the tutorials or the course forums.
Submit the report
Your work will not be assessed until you submit the report via the USQ submission. The submission date of your assignment is deemed to be the date of the USQ assignment submission.
Your own work please
Be warned, the issue of plagiarism is taken seriously, and the penalties are harsh. USQ policies on plagiarism may be found here.

Part 1
(Goes in the report)

HTTP
- Explain in your own words the purpose of each of the "words" or "fields" of a request line.
- Explain how the parameters of a CGI GET request are bundled into the request-URI.
- Explain percent encoding.
- Explain in your own words the purpose of each of the "words" or "fields" of a response line.
- What is the purpose of the "host" header of a request, and why it is mandatory.
- Explain the Content-Type header. What is the difference between "text/html" and "application/html".
Observing HTTP in action
- Use telnet to download the file "index.html" from https://example.com. Show the command and the output in report.
- Use telnet to attempt to download the file "wontBeThere.html" from https://bology.com.au. This one times out pretty fast, so you will have to be ready to paste your HTTP request into your telnet conversation. Show the command and the output in report.
netSrvDemo
- Build and test netSrvDemo. You will need to use two command line windows to do this. In one command line window, invoke netSrvDemo. In the other command line window, invoke the telnet command with the host "localhost" and the port number 9991 as arguments. Type some text, and press enter. Take screenshots of your two command line windows and paste them into your report.
- Copy the function main() from netSrvDemo.c into your report, and comment every line of code.

Part 2

Your task
You will implement a very basic HTTP 1.0 web server, with error handling, that can deliver files. You can test your server using telnet while you are developing it, but when completed, you should be able to point a standard web browser at it.
You may well be able to re-use nearly all the code from assignment 0.
Pseudocode

* Initialise logging.
* Read configuration.
* Initialise server object.
* Loop:-
* Get a connection
* Read only the first line (which should be a request line).
* Split the line into words
* if there are the wrong number of words.
* Send appropriate HTTP rejection. (status code 400)
* else if the request is not "GET"
* Send appropriate HTTP rejection. (status code 501)
* else if the file is not a decent absolute path
* Send appropriate HTTP rejection. (status code 404)
* else if the file does not exist in the configuration directory
* Send appropriate HTTP rejection. (status code 404)
* else
* Send appropriate HTTP acceptance. (status code 200)
* close the connection and free resources.

Attachment:- Assignment.zip

Request for Solution File

Ask an Expert for Answer!!
Computer Networking: Csc8415 computer network programming - compile and run your
Reference No:- TGS02884976

Expected delivery within 24 Hours