Problem using SocketServer.ThreadingTCPServer on Windows?

xtian xtian at paradise.net.nz
Thu May 31 06:57:41 EDT 2001


On 31 May 2001 09:34:49 GMT, Panu A Kalliokoski
<pkalliok at cc.helsinki.fi> wrote:

>xtian at hyperactive.co.nz wrote:
>> Hi -
>
>> I'm trying to implement a simple multi-threaded chat-type server,
>> following an implementation example from Java, but I was amazed to see
>> that SocketServer had done all the infrastructure work for me. 
>
>Um... how can you make a chat server with SocketServer? SocketServer is a 
>synchronous server, meaning in practice that there is only one connection 
>open at a time. If you're planning on using multiple connections, you 
>should use the asyncore & asynchat packages (which are part of the Python 
>main distribution) or my recent package, selecting, which is much better 
>IMHO and is available at http://sange.fi/~atehwa-u/selecting-0.8.tar.gz

Obviously, the only way to get more than one connection at a time to a
server using synchronous sockets is by using multithreading.

Granted, an asynchronous framework would give better scalability, but
the concepts are a bit more complicated, as far as I've seen. There
are lots of examples in Java using the same structure I'm using,
presumably because they're conceptually very simple. 

I'm just trying to get started with this kind of thing to get my head
around the various issues - the chat server isn't a goal, just
something with a base functionality that's close-ish to what I want to
do.

Actually, I hadn't even looked at asynchat - it might be just what I
need. I've downloaded your selecting package - can you give examples
of how it might be used? I'm not really familiar with asynchronous
networking.

Thanks,
Xtian

(I'd still be interested with what's going wrong with my server at a
code level, as well as at a structure level.)



More information about the Python-list mailing list