Get started with Twisted, the event-driven networking framework written in Python. With this introductory guide, you’ll learn the key concepts and design patterns to build event-driven client and server applications for many popular networking protocols. You’ll also learn the tools to build new protocols using Twisted’s primitives.
Start by building basic TCP clients and servers, and then focus on deploying production-grade applications with the Twisted Application infrastructure. Along the way, you can play with and extend examples of common tasks you’ll face when building network applications. If you’re familiar with Python, you’re ready for Twisted.
Learn the core components of Twisted servers and clients
Write asynchronous code with the Deferred API
Construct HTTP servers with Twisted’s high-level web APIs
Use the Agent API to develop flexible web clients
Configure and deploy Twisted services in a robust and standardized fashion
Access databases using Twisted’s nonblocking interface
Add common server components: logging, authentication, threads and processes, and testing
Explore ways to build clients and servers for IRC, popular mail protocols, and SSH
An Introduction to Twisted
Chapter 1 Getting Started
Installing from Source
Testing Your Installation
Using the Twisted Documentation
Finding Answers to Your Questions
Chapter 2 Building Basic Clients and Servers
A TCP Echo Server and Client
A TCP Quote Server and Client
Protocol State Machines
More Practice and Next Steps
Chapter 3 Writing Asynchronous Code with Deferreds
What Deferreds Do and Don’t Do
The Structure of a Deferred Object
Callback Chains and Using Deferreds in the Reactor
Jessica McKellar is a software engineer from Cambridge, MA. She enjoys the Internet, networking, low-level systems engineering, and contributing to and helping other people contribute to open source software. She is a Twisted maintainer, organizer for the Boston Python user group, and a local STEM volunteer.
Abe Fettig is a software developer and maintainer of Hep, an open source message server that makes it possible to transparently route information between RSS, email, weblogs, and web services. He speaks frequently at software conferences including PyCon and lives in Portland, Maine with his wife, Hannah.
The image on the cover of Twisted Network Programming Essentials, 2nd Edition showsa ball of snakes. When the ground begins to thaw in spring, things heat up for somespecies of snakes. Males emerge from their hibernation dens cold, hungry, and randy!An estimated 50,000 male snakes can fill a location such as a limestone quarry, waitingpatiently for nearby females to emerge. When they do, the mating frenzy begins, and itcan last up to three weeks.As many as 100 to 1,000 males will compete to mate with a single female, sometimessurrounding her before she can fully emerge from her den. The males wrap around thefemale, becoming a living ball that can grow to be two feet high. The constant writhingof the snakes can even propel the ball over rocks and tree roots.In some cases, the size of the snake ball will crush the female to death. However, thisdoes not always deter the males, who may continue to mate with her.A female will normally mate with only one male in the ball; once a male has successfullycopulated with her, he releases a pheromone that temporarily makes all other males inthe ball impotent. When the female selects her partner, the ball unravels and the unsuccessfulmales go in search of another female.Since it is difficult for snakes to determine the gender of their potential partner, malesdetect the female by using their flicking tongues to sense the female’s pheromones, whichstimulate the males to mate. The male rubs his chin against the grain of the female’sscales to squeeze out her pheromones. It is believed that the male can also determinethe position of the female by detecting the direction of her pheromones and then aligninghimself with her body accordingly.The cover image is from a 19th-century engraving from the Dover Pictorial Archive.The cover font is Adobe ITC Garamond. The text font is Adobe Minion Pro; the headingfont is Adobe Myriad Condensed; and the code font is Dalton Maag’s Ubuntu Mono.
Comments about oreilly Twisted Network Programming Essentials, 2nd Edition:
Chapter 3, "Writing Asynchronous Code with Deferreds" is the best presentation of deferreds I've ever seen. Showing how deferreds work without a running reactor is brilliant. To really grok their behaviour, going over the exercises to activate your brain does the trick. Since it's not possible to properly use Twisted without mastering deferreds, I'd say the thorough and engaging coverage of deferreds is worth the price of the book by itself.
Bottom Line Yes, I would recommend this to a friend