Threading with Socket Server

Boris FELD lothiraldan at gmail.com
Wed Mar 23 10:46:15 EDT 2011


I'm not sure to understand what you want. Is it your server process
that will read the shelve file ? You may give more informations about
your problem, but i can give you some hints.

In order to create a TCP server, you can use SocketServer which is in
the builtin library
(http://docs.python.org/library/socketserver.html). I'm not sure about
how shelve manage concurrency, but in my opinion, you'll need to
create a single process or thread which manage read and write
operation in order to avoiding race conditions.

Cheers,
Feld Boris

2011/3/23 T <misceverything at gmail.com>:
> Hello all, I am writing a Windows service that needs to 1) Act as a
> server (TCP), and write to a shelve file, and 2) Read that same shelve
> file every x number of seconds.  My thought is to create 2 separate
> classes (1 for the socket server and writing to the shelve file, and
> another to read the file and perform other requested actions) -
> however, I need to make sure they are both running concurrently.   I'm
> sure threading is involved, but my experience with it has been
> minimal, so any help to steer me in the right direction is greatly
> appreciated.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list