Asynchronous Socket with the ServerSocket module (??)

Steve Holden sholden at holdenweb.com
Tue Apr 30 08:18:15 EDT 2002


"guyon moree" <cheezus at wanadoo.nl> wrote in message
news:8Xgz8.730$5y4.17760 at castor.casema.net...
> hi all,
>
> i'm trying to write some sort of server program on linux. i stumbled into
> the ServerSocket module and it does pretty much what i want. i create a
> requesthandler class and pass it to the module and call server_forever()
By
> using ForkingTCPServer i am able to make it handle multiple connecties.
>
>
> all fine...
>
> but...
>
> how can i keep a list of connections and pass for example messages from
one
> client to the other through the server?
>
> thanx in advance, i am a newbie though.
>

Note that the SocketServer library was principally designed for services in
which a TCP connection is used for each request, rather than being
maintained continuously over a bunch of interactions. The server is
therefore structured for "requesthandler" to make sanes (as a name) in this
context.

To write (for example) a telnet server using the SocketServer you would have
to have your request handler establish a session and go through all the
interactions with the remote client, terminating only when the remote client
sent end-of-file.

So RequestHandler is something opf a misnomer: if you think of it as
"SessionHandler" you might get more sense out of the code.

lots-of-work-in-the-details-though-ly y'rs  - steve
--

Steve Holden: http://www.holdenweb.com/ ; Python Web Programming:
http://pydish.holdenweb.com/pwp/








More information about the Python-list mailing list