Skip to content

leeian1011/CWebServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C(had) Web Server

Why make a web server in C?

I wanted to know just what exactly happens or how on earth does a "server" even work or how would it even "understand" http requests
and how http requests/responses work. It started with this heavily abstracted java server-client program that taught me simple socket programming and how its like a literal two pin plug.

What I learned while making this abomination

  1. I literally had to relearn what passing by value and passing by reference meant which is why pointers exist
  2. Pointers are literally so much fun especially when it comes to figuring out how to free memory in a callee function from a pointer that was allocated memory in a called function
  3. RTFM has never worked so well until now, there was a point where I got the server to essentially serve it's purpose but it kept on reading from the socket even after the socket was closed. Only after reading through this doc that I learnt that shutdown() was a much better way of handling closing a socket than close() when using a TCP connection that ensures that data is sent.
  4. I oddly get motivated while building stuff that many people have deemed not needed to understand to learn programming.

Why ?

While learning Harvard's CS50 there was a time when the week's topic was on HTML, CSS and Javascript where we could just use a http-server command that lets us get a simple static web server up and running in literally no time but I was much more intrigued with how on earth does "http-server" work than I was building the week's project.

Extra what to do(s)

  1. tidy up the readme
  2. add some drawings
  3. video ???

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published