Started on Assignment part 2

I finally got started ever so slightly on the second part of the assignment today. On the morning I started piecing together parts from our two earlier pieces of code to make a webbserver. The first part is the UDP Peer to Peer chat we made which includes some functions and structure used to connect between to users over the Internet. The second part is a demonstration given to us which takes the html page google.com and displays its properties in the console. In addition and guidance to these I used the guide I mentioned in my previous blog post. Using all of these I was able to start working on setting up the structure of the program.

The assignment is to write a program which works as a webserver using Transmission control Protocol (TCP). The requirements of the program is primarily to be able to send HTTP/1.1 headers, (which I will look into once I actually have a program to send them with) but it also needs to be able to handle invalid GET requests and respect the clients’ browser connection header.

For the time being I’m still setting up the program after looking up the specifics of connecting through the use of bsd sockets. I started by using the webserver code example we had been given earlier in the course and added things from the guide and the UDP chat. The two main things I did were to add the struct for clients and peers in order for the program to handle individual requests. Keep in mind that the original program only receives a webpage from a specified web address rather than send info. The program created the individual socket and client in the main function so I moved both their constructors into their own functions in order to call them in the main loop. Most of the functions were almost entirely taken from the UDP chat program, although a few were modified slightly.

While I’m still very unsure about the most of the individual parts I feel like more and more of them are starting to make sense. I only wish I would have been able to start the first assignment earlier.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a comment