socket (multithread)

Steve Holden sholden at
Mon Sep 18 18:39:58 CEST 2000

izam96 at wrote:
> Hello
> i have writing a simple python code that run as a server that using
> socket module. I would like to connect to the server from 2 or more
> client (multithread) so it can send data to the server and the server
> can respond back.I'm getting trouble to to that because when the
> first client had connected to the server the second client cannot
> send any information to the server and also cannot get respond from
> the server.
Did you use the socketserver library?  In general, once a socket has an
active connection you need to run an active thread with that while some
other thread waits for new connections at the same address.

Don't forget a socket has two ends, and once those two ends are connected
nothing else can "break in" on the conversation.

> Is there any chat software(server/client) written in python??? or any
> example on socket programmming.

Take a look at the socketserver, SimpleHTTPserver and other library modules.
(although I seem to remember SimpleHTTPServer isn't programmed to handle
multiple concurrent service requests, it does at least discuss what you'd
need to do in practice).

Helping people meet their information needs with training and technology.
703 967 0887      sholden at

More information about the Python-list mailing list