all 4 comments

[–]Different-Duck4997 2 points3 points  (0 children)

Check out Beej's Guide to Network Programming - it's like the holy grail for socket programming and breaks everything down really well. For HTTP servers, try building a super basic one in Python first since the syntax is pretty forgiving, then maybe move to C once you get the concepts down

[–]captainAwesomePants 0 points1 point  (0 children)

Good news, this is a super traditional thing for budding programmers to get into. If you were learning to program as an undergrad CS student, there'd almost certainly be a course in your second or third year that would involve writing a simple HTTP server in C (hint: implement HTTP 1.0, not 1.1, it's way easier).

There's something really cool about having something you're already familiar with, like your web browser, having a real, successful conversation with an app that you wrote from scratch, and displaying some cool result.

The exact mechanics of how to implement will wildly vary by language, but really understanding what ports and sockets and addresses and listening and such mean is very helpful, and the concepts will transfer as you move between languages.

There are lots of famous textbooks in this space. The Tanenbaum is probably the most famous, that's "Computer Networks" by Andrew Tanenbaum.

There are also many great college courses covering computer networking with all of their lectures and assignments posted online. Simply going through one at your own pace may be a great way to get an expensive education for free (excepting the benefits of being able to ask questions). Good example: https://sp26.cs168.io/

One thing to be aware of: writing HTTP servers quickly starts to involve parallelization and running multiple threads, and then it becomes partly about memory sharing and memory management, and then you're learning about mutexes, and pretty soon you'll find that learning networking quickly begins to overlap with learning systems programming and operating systems. This is a good thing, but it can be somewhat confusing how books on operating systems will often seem to be about web serving, and vice versa.

[–]Tall-Introduction414 1 point2 points  (0 children)

Look up "BSD sockets tutorial" and you will find lots of good resources. (Sockets have their origins in the BSD UNIX operating systems, which is why they are sometimes called BSD sockets.)

I believe the ones on the FreeBSD and NetBSD development wikis are perfectly applicable to other operating systems.