Foundations of Python Network Programming

The Comprehensive Guide to Building Network Applications with Python

John Goerzen

Publisher: Apress, 2004, 512 pages

ISBN: 1-59059-371-5

Keywords: Python, Networks

Last modified: Nov. 9, 2008, 11:33 a.m.

To guide readers through the new scripting language, Python, this book discusses every aspect of client and server programming. And as Python begins to replace Perl as a favorite programming language, this book will benefit scripters and serious application developers who want a feature-rich, yet simple language, for deploying their products.

The text explains multitasking network servers using several models, including forking, threading, and non-blocking sockets. Furthermore, the extensive examples demonstrate important concepts and practices, and provide a cadre of fully-functioning stand alone programs. Readers may even use the provided examples as building blocks to create their own software.

  • Part I: Low-Level Networking
    • Chapter 1: Introduction to Client/Server Networking
      • Understanding TCP Basics
      • Using the Client/Server Model
      • Understanding User Datagram Protocol
      • Understanding Physical Transports and Ethernet
      • Networking in Python
      • Summary
    • Chapter 2: Network Clients
      • Understanding Sockets
      • Creating Sockets
      • Communicating with Sockets
      • Handling Errors
      • Using User Datagram Protocol
      • Summary
    • Chapter 3: Network Servers
      • Preparing for Connections
      • Accepting Connections
      • Handling Errors
      • Using User Datagram Protocol
      • Using inetd or xinetd
      • Logging with syslog
      • Avoiding Deadlock
      • Summary
    • Chapter 4: Domain Name System
      • Making DNS Queries
      • Using Operating System Lookup Services
      • Using PyDNS for Advanced Lookups
      • Summary
    • Chapter 5: Advanced Network Operations
      • Half-Open Sockets
      • Timeouts
      • Transmitting Strings
      • Understanding Network Byte Order
      • Using Broadcast Data
      • Working with IPv6
      • Binding to Specific Addresses
      • Using Event Notification with poll () or select ()
      • Summary
  • Part II: Web Services
    • Chapter 6: Web Client Access
      • Fetching Web Pages
      • Authenticating
      • Submitting Form Data
      • Handling Errors
      • Using Non-HTTP Protocols
      • Summary
    • Chapter 7: Parsing HTML and XHTML
      • Understanding Basic HTML Parsing
      • Handling Real-World HTML
      • A Working Example
      • Summary
    • Chapter 8: XML and XML-RPC
      • Understanding XML Documents
      • Using DOM
      • Using XML-RPC
      • Summary
  • Part III: E-mail Services
    • Chapter 9: E-Mail Composition and Decoding
      • Understanding Traditional Messages
      • Composing Traditional Messages
      • Parsing Traditional Messages
      • Understanding MIME
      • Composing MIME Attachments
      • Composing MIME Alternatives
      • Composing Non-English Headers
      • Composing Nested Multiparts
      • Parsing MIME Messages
      • Summary
    • Chapter 10: Simple Message Transport Protocol
      • Introducing the SMTP Library
      • Error Handling and Conversation Debugging
      • Getting Information from EHLO
      • Using Secure Socket Layer and Transport Layer Security
      • Authenticating
      • SMTP Tips
      • Summary
    • Chapter 11: POP
      • Connecting and Authenticating
      • Obtaining Mailbox Information
      • Downloading Messages
      • Deleting Messages
      • Summary
    • Chapter 12: IMAP
      • Understanding IMAP in Python
      • Introducing IMAP in Twisted
      • Understanding Twisted Basics
      • Scanning the Folder List
      • Examining Folders
      • Basic Downloading
      • Flagging and Deleting Messages
      • Retrieving Message Parts
      • Finding Messages
      • Adding Messages
      • Creating and Deleting Folders
      • Moving Messages Between Folders
      • Summary
  • Part IV: General-Purpose Client Protocols
    • Chapter 13: FTP
      • Understanding FTP
      • Using FTP in Python
      • Downloading ASCII Files
      • Downloading Binary Files
      • Uploading Data
      • Handling Errors
      • Scanning Directories
      • Downloading Recursively
      • Manipulating Server Files and Directories
      • Summary
    • Chapter 14: Database Clients
      • SQL and Networking
      • SQL in Python
      • Connecting
      • Executing Commands
      • Transactions
      • Repeating Commands
      • Retrieving Data
      • Reading Metadata
      • Using Data Types
      • Summary
    • Chapter 15: SSL
      • Understanding Network Vulnerabilities
      • Reducing Vulnerabilities with SSL
      • Understanding SSL in Python
      • Using Built-in SSL
      • Using OpenSSL
      • Verifying Server Certificates with OpenSSL
      • Summary
  • Part V: Server-Side Frameworks
    • Chapter 16: SocketServer
      • Using BaseHTTPServer
      • SimpleHTTPServer
      • CGIHTTPServer
      • Implementing New Protocols
      • IPv6
      • Summary
    • Chapter 17: SimpleXMLRPCServer
      • SimpleXMLRPCServer Basics
      • Serving Functions
      • Exploiting Class Features
      • Using DocXMLRPCServer
      • Using CGIXMLRPCRequestHandler
      • Supporting Multicall Functions
      • Summary
    • Chapter 18: CGI 
      • Setting Up CGI
      • Understanding CGI
      • Understanding CGI in Python
      • Retrieving Environment Information
      • Getting Input
      • Escaping Special Characters
      • Handling Multiple Inputs per Field
      • Uploading Files
      • Using Cookies
      • Summary
    • Chapter 19: mod_python
      • Understanding the Need for mod_python
      • Installing and Configuring mod_python
      • Understanding mod_python Basics
      • Dispatching Requests
      • Handling Input
      • Escaping
      • Understanding Interpreter Instances
      • Prebuilt Handlers in mod_python
      • Summary
  • Part VI: Multitasking
    • Chapter 20: Forking
      • Understanding Processes
      • Understanding fork ()
      • Forking First Steps
      • Forking Servers
      • Locking
      • Error Handling
      • Summary
    • Chapter 21: Threading
      • Threading in Python
      • Writing Threaded Servers
      • Writing Threaded Clients
      • Summary
    • Chapter 22: Asynchronous Communication
      • Deciding Whether or Not to Use Asynchronous Communication
      • Using Asynchronous Communication
      • Advanced Server-Side Use
      • Monitoring Multiple Master Sockets
      • Using Twisted for Servers
      • Summary

Reviews

Foundations of Python Network Programming

Reviewed by Roland Buresund

Outstanding ********* (9 out of 10)

Last modified: May 21, 2007, 3:04 a.m.

This is an excellent book about network programming. In fact, it is so good that I could even envisage creating a networking course around it! The only things preventing it from getting a straight ten, is the shallow coverage of Twisted (of course, it would probably make the book twice the size) and the pretty one-sided Linux/Unix coverage (it would have been nice to see some Windows and MacOS specifics added, as it is Python).

Anyway, you wont regret reading this book.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required