Introduction to sockets

Sockets are the main component that allows us to take advantage of the operating system's capabilities to interact with the network. You can think of sockets as a point-to-point communication channel between a client and a server.

Network sockets are an easy way to establish a communication between processes that are on the same or different machines. The concept of a socket is very similar to that of UNIX file descriptors. Commands such as read() and write() ( to work with the file system ) work in a similar way to sockets.

A network socket address consists of an IP address and port number. The goal of a socket is to communicate processes through the network.

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.