Fundamentals of Network Programming in Python
376 pages
English
PDF
4.5

Fundamentals of Network Programming in Python

Fundamentals of Network Programming in Python

Author:

Year:

Summary:

Introduction

The book "Fundamentals of Network Programming in Python" (original title Foundations of Python Network Programming) is a classic guide that has been helping developers master the intricacies of working with network protocols in Python for over a decade. The authors, Brandon Rhodes and John Goerzen, renowned experts in Python and networking technologies, have created a practical handbook that covers both basic concepts (sockets, TCP/UDP) and advanced topics (HTTP, SMTP, SSH, SSL/TLS). Despite the book being published in 2014, its content remains relevant for Python 3 and modern network applications.

What this book is about

The book is structured as a gradual immersion into the world of network programming. It starts with the basics: what sockets are, how TCP and UDP work, how to establish connections and transfer data. The authors then move on to higher-level protocols and libraries that Python provides for working with them. Special attention is paid to practical examples: each section is accompanied by working code that can be immediately run and modified.

Main topics of the book

  • Sockets and the transport layer: creating TCP and UDP clients and servers, error handling, timeouts, non-blocking I/O.
  • HTTP and web services: writing HTTP clients and servers, working with the http.client and urllib libraries, parsing headers, cookies, authentication.
  • Email: sending and receiving emails via SMTP, POP3, IMAP, working with MIME attachments.
  • SSH and security: using the paramiko library for remote server management, configuring SSH tunnels.
  • SSL/TLS: encrypting connections, working with certificates, creating secure sockets.
  • Multithreading and asynchronicity: using threads, processes, and the asyncio library to create scalable servers.
  • Application layer protocols: DNS, FTP, Telnet, as well as writing custom protocols over TCP/UDP.

Who this book is for

The book is aimed at developers who are already familiar with the basics of Python (syntax, functions, classes) and want to delve into network programming. It will be useful for:

  • Backend developers creating web services, APIs, and microservices.
  • Network engineers automating device configuration and monitoring.
  • DevOps specialists writing scripts for server management and deployment.
  • Students and teachers studying computer networks in practice.

What the reader will learn

After reading the book, you will be able to:

  • Create TCP and UDP clients and servers from scratch.
  • Work with HTTP requests and responses, including REST APIs.
  • Send and receive emails programmatically.
  • Establish SSH connections and execute commands on remote machines.
  • Ensure the security of network connections using SSL/TLS.
  • Write asynchronous servers handling thousands of connections.
  • Understand the internal workings of popular protocols and libraries.

Strengths of the book

  • Practical focus: every example can be immediately run and tested. The code is written in Python 3 style and easily adaptable to modern versions.
  • In-depth explanation: the authors not only show how to use libraries but also explain how protocols work at the packet level.
  • Structure: the book is logically divided into chapters, from simple to complex. It can be read sequentially or used as a reference.
  • Relevance: despite the year of publication, the fundamental principles of network

Recommendations