asyncore | index /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py Module Docs |
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 | ||||||
|
Classes | ||||||||||||||||||||||||||||||||
|
Functions | ||
|
Data | ||
EAGAIN = 35 EALREADY = 37 EBADF = 9 ECONNABORTED = 53 ECONNRESET = 54 EINPROGRESS = 36 EINTR = 4 EINVAL = 22 EISCONN = 56 ENOTCONN = 57 EPIPE = 32 ESHUTDOWN = 58 EWOULDBLOCK = 35 errorcode = {1: 'EPERM', 2: 'ENOENT', 3: 'ESRCH', 4: 'EINTR', 5: 'EIO', 6: 'ENXIO', 7: 'E2BIG', 8: 'ENOEXEC', 9: 'EBADF', 10: 'ECHILD', ...} socket_map = {} |