Socket Programming in Python Part 1: Handling Connections
Sockets and the socket API are used to send messages across a network. They provide a form of inter-process communication (IPC). The network can be a logical, local network to the computer, or one that’s physically connected to an external network, with its own connections to other networks. The obvious example is the Internet, which you connect to with your ISP.
In this two-part series, you’ll create:
- A simple socket server and client
- An improved version that handles multiple connections simultaneously
- A server-client application that functions like a full-fledged socket application, complete with its own custom header and content
By the end of part one, you’ll understand how to use the main functions and methods in Python’s socket module to write your own client-server applications, including ones with multiple connections. In part two, you’ll dive into building a custom class and handling errors.
[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]