Hacker News new | ask | show | jobs
by infocollector 521 days ago
Does anyone know - Is there a guide like this that does this with Python instead of the C Socket API?
4 comments

I don't know of one. However, Python's socket API is mostly a thin wrapper around the C socket API. Assuming you know Python, it should be easy enough to learn from a tutorial like this one without a Python-specific guide. Note the matching function and constant names:

https://docs.python.org/dev/library/socket.html#socket.socke...

The official Python documentation actually comes with a Socket Programming HOWTO that goes over conceptual topics and intended socket API usage:

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.

How about this? https://realpython.com/python-sockets/

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.