How to manage two (different) sockets without using threads?
Maksim Kasimov
maksim.kasimov at gmail.com
Wed Dec 13 12:14:49 EST 2006
Hi, i don't know how to do it with asyncore/asynchat,
but it is possible to handle different sockets in one process by using "select" standard module:
for_reading, for_writing, where_errors =\
select.select( (<sockets list> ), ( <sockets list> ), (<sockets list>), 0)
you can find all necessary information in python documentation:
http://www.python.org/doc/2.4/lib/module-select.html
btw: "asyncore" use "select" for socket handling, take a look in asyncore.py
hope it helps
billie wrote:
> Hi all.
> I'm (re)writing an FTP server application by using asyncore/asynchat
> modules.
> FTP tipically got two different channels: command and data.
> I'm succesfully managing command channel through asynchat framework,
> but I'm not sure about how to manage data channel without using a
> thread/subprocess.
> Is there an optimal to do that?
> Can anyone point me in the right direction?
>
--
Maksim Kasimov
More information about the Python-list
mailing list