asynchat

The asynchat module simplifies the implementation of applications that implement asynchronous networking using the asyncore module. This module extends the capabilities of the dispatcher class in asyncore by adding some features that make it easier to handle protocols based on a simple request/response mechanism (for example, HTTP).

To use this module, you must define a class that inherits from async_chat. Within this class, you must define two methods: collect_incoming_data() and found_terminator(). The first method is invoked whenever data is received on the network connection. Typically, it would simply take the data and store it someplace. The found_terminator() method is called when the end of a command request has been detected. ...

Get Python: Essential Reference, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.