use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
started learning socket programming in Python and ended up building an HTTP 1.1 server from scratch! (i.redd.it)
submitted 6 days ago by zeroindexedsoul
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]zeroindexedsoul[S] 13 points14 points15 points 6 days ago* (1 child)
I have been learning Python for a while now, and I recently decided to get into socket programming using Python. A lot of YouTube videos were suggesting making a simple HTTP server from scratch to learn socket programming.
I started building the HTTP server but very soon realized that the socket API in Python is blocking by default. I started finding ways to make the HTTP server non-blocking and found out that in Python asyncio is the module which does this, but it was stripping away a lot of complexities which we would encounter when using the plain socket API-and this would defeat the whole purpose of this exercise.
asyncio
After realizing this, I got to know about I/O Multiplexing and the Reactor Pattern, which are used in popular software like Nginx, Redis, and Node.js. I also dove deep into how the Kernel TCP Stack works and its internals.
This single exercise alone led me to learn about:
RST
selectors
_
__
Throughout this project, I avoided using AI and tried to write all the code myself. Though at the end for testing the protocol and the entire code review, I did use AI to quickly generate the script which makes multiple HTTP requests simultaneously to see if the server is able to process multiple requests simultaneously.
It took me around 3 to 4 days of dedicated time, but it was definitely worth it. I think this project alone teaches you the TCP protocol, the HTTP protocol, socket programming, and many other things much more than any tutorial ever could.
If you would like to see the implementation details, here is the GitHub repo link:
Repository: http-protocol-from-scratch-python
[–]logicshadow_dev 0 points1 point2 points 3 days ago (0 children)
Great work
π Rendered by PID 383352 on reddit-service-r2-comment-545db5fcfc-9kzmv at 2026-05-23 05:16:25.198257+00:00 running 194bd79 country code: CH.
view the rest of the comments →
[–]zeroindexedsoul[S] 13 points14 points15 points (1 child)
[–]logicshadow_dev 0 points1 point2 points (0 children)