Name
loop
Synopsis
loop( )
Implements the asynchronous event loop, dispatching all network
events to previously instantiated dispatcher objects.
loop terminates when all dispatcher objects (i.e.,
all communication channels) are closed.
Module asyncore also
supplies class dispatcher, which supplies all
methods of socket objects, plus specific methods for event-driven
programming, with names starting with 'handle_‘.
Your class X subclasses
dispatcher and overrides the
handle_ methods for all events you need to handle.
To initialize an instance d of
dispatcher, you can pass an argument
s, an already connected socket object.
Otherwise, you must call:
d.create_socket(socket.AF_INET,socket.SOCK_STREAM)and then call on d either
connect, to connect to a server, or
bind and listen, to have
d itself be a server. The most frequently
used methods of an instance d of a
subclass X of
dispatcher are the following.