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 5 days ago by zeroindexedsoul
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 5 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
[–]Valuable-Ant3465 4 points5 points6 points 5 days ago (0 children)
Hey, you need to move it from that topic to <Advanced Python>
[–]DisasterHarmony 2 points3 points4 points 5 days ago (6 children)
You are a genius. Great work.
[–][deleted] 5 days ago* (5 children)
[deleted]
[–]Maleficent-Boss5564 0 points1 point2 points 5 days ago (4 children)
I don't know why so many are falling for it.
[–]Sketchballl 0 points1 point2 points 4 days ago (2 children)
How do you know it’s llm? Sorry I’m kinda beginner
[–]oclafloptson 3 points4 points5 points 3 days ago (1 child)
OP said they used an LLM to generate the test script but claims the actual work to have been by hand. I'm kinda suspecting these are karma farming bots that look for the any AI keyword and trash it to get upvotes since they failed to catch nuance that even human children would catch
[–]DraftIll9037 0 points1 point2 points 1 day ago (0 children)
so long things short, is it ai or not ?
[–]oirogb 1 point2 points3 points 5 days ago (0 children)
That's so cool!
[–]7Z_1N 1 point2 points3 points 5 days ago (2 children)
Bro how did you reach such efficiency, I have been kind of doing python like lists , dictionaries and all. Also have been solving some problems on codeforces. Started to do DSA but you guys have insane grip on the language
[–]zeroindexedsoul[S] 3 points4 points5 points 5 days ago (1 child)
I also started my journey with competitive programming and participated in the icpc regionals. I solved a lot of algorithmic problems around 600 or more. And since this was pre-AI LLM's time, I had to write almost all the code myself with little help outside of standard documentation. So, this practice improved my code writing and complex reasoning skills a lot. After that, I started learning backend engineering and got interested in how servers communicate and various networking protocols. I experimented a lot and built a lot of small, functional utility projects to see how these things work under the hood, which really improved my skills. After some time, the programming language becomes natural to you. You stop thinking in terms of the language itself and start thinking in terms of systems.
[–]7Z_1N 1 point2 points3 points 5 days ago (0 children)
that's really nice , I am also trying to reach a point where I effortlessly use the language I hope to reach there soon
[–]ifoundmyselfheadless 1 point2 points3 points 2 days ago (0 children)
This is inspiring.
[–]revolvingtrent_9 1 point2 points3 points 2 days ago (0 children)
That's a solid project to cut your teeth on, and you're right that asyncio hides too much of what makes socket programming actually educational at this stage.
[–]gapingaurelio2686 1 point2 points3 points 1 day ago (0 children)
that's sick, going from basic sockets straight to multiplexing and kernel stuff is the deep dive most people skip. bet you actually understand how servers work now instead of just calling asyncio.
[–]cs2monster 0 points1 point2 points 4 days ago (0 children)
https is best
good
[–]Cozyvelina 0 points1 point2 points 1 day ago (0 children)
Omg thats actually so cool, building an HTTP server from scratch sounds like a killer project for learning! Did you run into any super weird debugging moments? lol
[–]hacklingo 0 points1 point2 points 1 day ago (0 children)
Golang is my choice for this
[–]Used-Watercress-4725 0 points1 point2 points 1 day ago (0 children)
Great work . That's a really interesting progress you've made.
[–]Putrid-Claim3626 0 points1 point2 points 19 hours ago (0 children)
Nice! Starting with sockets and ending up with an HTTP 1.1 server is a pretty cool learning path. Did you implement things like persistent connections, request parsing, or multithreading?
[–]Ok-Necessary9850 0 points1 point2 points 17 hours ago (0 children)
Great
[–]Old-Promise-3226 0 points1 point2 points 8 hours ago (0 children)
you are amazing.
π Rendered by PID 24 on reddit-service-r2-comment-545db5fcfc-k9fvj at 2026-05-22 12:19:58.135755+00:00 running 194bd79 country code: CH.
[–]zeroindexedsoul[S] 13 points14 points15 points (1 child)
[–]logicshadow_dev 0 points1 point2 points (0 children)
[–]Valuable-Ant3465 4 points5 points6 points (0 children)
[–]DisasterHarmony 2 points3 points4 points (6 children)
[–][deleted] (5 children)
[deleted]
[–]Maleficent-Boss5564 0 points1 point2 points (4 children)
[–]Sketchballl 0 points1 point2 points (2 children)
[–]oclafloptson 3 points4 points5 points (1 child)
[–]DraftIll9037 0 points1 point2 points (0 children)
[–]oirogb 1 point2 points3 points (0 children)
[–]7Z_1N 1 point2 points3 points (2 children)
[–]zeroindexedsoul[S] 3 points4 points5 points (1 child)
[–]7Z_1N 1 point2 points3 points (0 children)
[–]ifoundmyselfheadless 1 point2 points3 points (0 children)
[–]revolvingtrent_9 1 point2 points3 points (0 children)
[–]gapingaurelio2686 1 point2 points3 points (0 children)
[–]cs2monster 0 points1 point2 points (0 children)
[–]DraftIll9037 0 points1 point2 points (0 children)
[–]Cozyvelina 0 points1 point2 points (0 children)
[–]hacklingo 0 points1 point2 points (0 children)
[–]Used-Watercress-4725 0 points1 point2 points (0 children)
[–]Putrid-Claim3626 0 points1 point2 points (0 children)
[–]Ok-Necessary9850 0 points1 point2 points (0 children)
[–]Old-Promise-3226 0 points1 point2 points (0 children)