I am writing a program that is to behave as a web server. Both the client and the server code are on my laptop. Ideally, I should be able to type in 127.0.0.1: PORT/index.html in Firefox and the server code should reply appropriately. So far my browser and the server are talking - that is, Firefox sends the request packet that I am printing on the screen.
I am having trouble with figuring out how to send a response to the client. How does one develop a response packet? Do I just write the data into a buffer array of some sort and then push that through? How do I embed/include the index.html page in the response packet?
Any help would be greatly appreciated.