Instant Messenger

Heiko Wundram heikowu at ceosg.de
Tue Jul 30 12:28:28 EDT 2002


Hi Chris!

On Tue, 2002-07-30 at 03:17, Chris wrote:
> Questions:
> Once the server has validated the username and password, I want to store the
> socket that I used to recv() the username and password so that I can send
> messages to it later (i.e. when another user logs on).  Also, I want to be
> able to keep a list of all the users logged in, which I guess is one in the
> same with the last sentence.  Is any of this possible without threading?

Humm... Why not choose a different scheme? Instead of sending out
messages using the open sockets, why not have the server only care for
storing the messages, and the clients doing a continuous poll? In my
oppinion 15 seconds would be way enough... That way you don't have to
deal with many different connections on the one computer, but instead
you can serve out pages in an RPC-like fashion. (I presume this works
much more easily...)

And, one more added benefit: if you e.g. use XML-RPC to do the queries,
then you can also stream all messages through a web-proxy easily,
without having to change the protocol (like ICQ over Proxy, etc. have
to).

If you're interested, I can send you my base-implementation of an
XML-RPC server which works multi-threaded, including code to do
multi-threaded database connection sharing.

The server is based on a module architecture, where modules do all the
work that you actually want to serve via RPC.

btw: I'm using the server as a backend for a web-application doing
pretty much the same thing that you want to do... ;)

Just my 5 cents... :)

	Heiko W.





More information about the Python-list mailing list