Web Server

Introduction:

Below is the code provided by the instructor for this project.

A. One of the purposes of this project is to test the web server with multiple files types. Those types are an HTML file, an image file type, and any other file type.

B. The other purpose of this project was to implement persistent connection or the sending of files in chunks.

Main function:

Before creating the main function, socket and the function Web_Handler were imported.
The main function creates the server socket needed at port 80.
The socket then accepts connections coming in from the outside.
It then calls the Web_Handler function to continue.


The Web_Handler function:

This is where the header is sent, the request is processed, and the body are created. This function is called by the main method to take care of these processes.



Problem Discussion:

A. The first task is to use the code provided to test the WebServer with multiple file types.

1. 
The first file type tested was an html file called index.html .
The file was input in the code above (it has a comment up there).
This was done successfully and the HTML file was displayed properly.
The video below shows the process of doing so, and the result.



2. 
The second file type i tested was a PNG file type called barca.png .
I tested this in two ways.
The first way was to embed the barca.png file in the index.html file to test if it appears.

The second way was to run the main function, and then at the address bar type in localhost/barca.png

Both tests were successful. The video below shows the testing and the result.
(the first part shows the first way, the second part shows the second way)



3.
The third file type that i tested was an ICO file type called favicon.ico .
I also tested this file type in two ways.
The first way involved embedding the favicon.ico into the index.html file in order to test if it appears.
The second way involved running the main function, and then entering localhost/favicon.ico in the address bar.

Both of these tests were successful. The results for both are in the video below.
(first part of the video shows the first method, the second part shows the second)



4. 
I was also interested to see if a video would work, so i tested it.
I used a video called video1.mp4 (from the previous SushiBot project)
I used the same test methods that i used in the 2 file types above.
In the first way, i embedded an mp4 video in the index.html file.
In the second way, i ran the main function, and wrote localhost/video1.mp4

Below are the tests for the mp4 video.
Chrome:

*Error* For both testing methods, the file was obtained, and although the audio of the video would play, the image would not appear. 



Microsoft Edge:

After the video would not appear, i decided to test the program in a different browser. I selected Microsoft Edge. Both testing methods were successful. There was both sound and picture in both cases.

B. The second task was to implement keep alive or the sending of files in chunks.

I chose to attempt to implement keep alive. After reading some documents, the closest i could get to implementing was by adding the code below.


I used those 2 links to inform me about the potential use of SIO_KEEPALIVE_VALS.
SIO_KEEPALIVE_VALS enables the setting of the TCP keep alive option which specifies timeout and the keep alive interval. I specified the keep alive timeout to 8 seconds and the keep alive interval to 1 second.
Below is the test for keep alive.


Conclusion:

When testing the Web Server with an HTML, PNG, ICO, and MP4 file types, they all successfully worked. Only the mp4 file had an error, however, the error was fixed after using a different web browser.

After doing that, i attempted to implement keep alive. I am not completely sure if there would be a major difference if any, after including the code i did, but it seems that it does not stop even when i
continue making calls to the various files i have.

*The files used for the testing of the Web Server will be submitted on Blackboard with the link to this project*


Comments

Popular posts from this blog

IBM Watson

SushiBot