asynchat and threading

Michele Simionato michele.simionato at gmail.com
Thu Nov 25 02:52:09 EST 2004


Anthony Baxter <anthonybaxter at gmail.com> wrote in message news:<mailman.6771.1101346778.5135.python-list at python.org>...

<snip a lot of interesting comments>

I have the following problem, and I would like to know if asyncore or
twisted could be of help here, and which one you would suggest. 
I have a few users (say 100) who want to send small bunches of text 
(say 1K in size) to a remote server via TCP; the server should save 
these texts in a small database. The server should be able to catch the 
messages from the different users and "synchronize" them (not sure what the 
right word is): if two messages arrive at the same time they are written one
after the other to the database. In this way the database has not to 
worry about concurrency issues and I could just use shelve; the 
messages will be stored as a mapping usernames -> messages. I would
rather NOT use a "real" database, since the load is very
small and I do not want to install and maintain a database server in
the remote machine for something so simple. The order of arrival of the 
messages is not important. The message has to be stored when the termination
char arrives, so I was thinking about using asynchat. But maybe twisted has
already a pre-built solution for this problem.

Any hints?


                           Michele Simionato



More information about the Python-list mailing list