asyncore
index
/usr/lib/python2.2/asyncore.py

Basic infrastructure for asynchronous socket service clients and servers.
 
There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.
 
If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.

 
Modules
            
exceptions
fcntl
os
select
socket
sys
 
Classes
            
exceptions.Exception
ExitNow
dispatcher
dispatcher_with_send
file_dispatcher
file_wrapper
 
class ExitNow(exceptions.Exception)
       
   Data and non-method functions defined here:
__doc__ = None
__module__ = 'asyncore'

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class dispatcher
       
   Methods defined here:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__init__(self, sock=None, map=None)
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_accept(self)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'asyncore'
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0
 
class dispatcher_with_send(dispatcher)
       
   Methods defined here:
__init__(self, sock=None)
handle_write(self)
initiate_send(self)
send(self, data)
writable(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'asyncore'

Methods inherited from dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_accept(self)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
set_reuse_addr(self)
set_socket(self, sock, map=None)

Data and non-method functions inherited from dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0
 
class file_dispatcher(dispatcher)
       
   Methods defined here:
__init__(self, fd)
set_file(self, fd)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'asyncore'

Methods inherited from dispatcher:
__getattr__(self, attr)
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
__repr__(self)
accept(self)
add_channel(self, map=None)
bind(self, addr)
close(self)
connect(self, address)
create_socket(self, family, type)
del_channel(self, map=None)
handle_accept(self)
handle_close(self)
handle_connect(self)
handle_error(self)
handle_expt(self)
handle_expt_event(self)
handle_read(self)
handle_read_event(self)
handle_write(self)
handle_write_event(self)
listen(self, num)
log(self, message)
log_info(self, message, type='info')
readable(self)
recv(self, buffer_size)
send(self, data)
set_reuse_addr(self)
set_socket(self, sock, map=None)
writable(self)

Data and non-method functions inherited from dispatcher:
accepting = 0
addr = None
closing = 0
connected = 0
debug = 0
 
class file_wrapper
       
   Methods defined here:
__init__(self, fd)
# here we override just enough to make a file
# look like a socket for the purposes of asyncore.
close(self)
fileno(self)
read = recv(self, *args)
recv(self, *args)
send(self, *args)
write = send(self, *args)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'asyncore'
 
Functions
            
close_all(map=None)
compact_traceback()
loop(timeout=30.0, use_poll=0, map=None)
poll(timeout=0.0, map=None)
poll2(timeout=0.0, map=None)
poll3(timeout=0.0, map=None)
 
Data
             DEBUG = 0
EALREADY = 114
ECONNRESET = 104
EINPROGRESS = 115
EINTR = 4
EISCONN = 106
ENOTCONN = 107
ESHUTDOWN = 108
EWOULDBLOCK = 11
__file__ = '/usr/lib/python2.2/asyncore.pyc'
__name__ = 'asyncore'
socket_map = {}