About A comprehensive guide for Linux Network (Socket) programming
github.com
github.com
Since I didn’t see this in the list of references, I have to ask — have you heard of the (famous) Beej’s Guide to Network Programming [1]? It’s a classic (in the sense that it’s been around for a long, long time and goes into many more details) on this topic.
What an amazing resource.
I feel like the last time I looked at it, it has been updated too so was pretty current.
Also agree the OP looks like a good guide.
As you say, just lots of bad examples online. The only thing that made me a little bit crazy at the beginning, was the fact that TCP is a stream without delimiters, no packet concept. Other than that, is not more difficult than writing and reading a file.
[0] https://docs-archive.freebsd.org/44doc/psd/20.ipctut/paper.p...
Another useful resource: https://beej.us/guide/bgnet/
Edit: beej seems already cited and beloved
read <---- write
write ----> read
Implies that send/recv perfectly correlate to each other when they can be split up in stream sockets. Your code addresses that already with loops. So I know you know that. Just confusing diagrams I guess.
https://docs.python.org/dev/library/socket.html#socket.socke...
https://docs.python.org/dev/howto/sockets.html#socket-howto
It gets overlooked because most folks only check the Tutorial and the Standard Library sections.
Seems to cover all the basics...
Typically,
1) you just understand the workflow of your socket server and client
2) you then decide between TCP and UDP - and even if you want to work at higher layers like http or rpc - for the application you want to code
3) start coding with the boiler plate code for something like echo server and client.