MultiThread Socket on NT

Werner Schiendl ws-news at
Fri Nov 16 11:59:12 CET 2001


did you notice, that the SocketServer module contains a ready-made socket
It even includes a threaded server (2 in fact, ThreadingTCPServer and

Your problem with performance could come from creating a new thread for
every request.
Depending on the OS, creating threads may be an expensive operation.
(e. g. Windows calls the DllMain() function in all loaded DLLs, unless they
explicitely specified they do not want this)

To have a better scalable solution, you could use a thread pool.


"GT" <guy.theisen at> wrote in message
news:e253b770.0111152322.7a1933c5 at
> Hi,
>   I have a Simple Thread Socket Server. But if I lunch the Socket Server,
>   many clients connect to this server, I must wait a long time for an
>   I use in this case a simple Thread.
>   while 1:
>         conn, addr = s.accept()
>         if fail:
>             thread = threading.Thread(target=burp, args=(conn,addr))
>             thread.start()
>         else:
>             burp(conn,addr)
>  But how can I set up a multithread Socket ?
> Thanks for any help,
> GT

More information about the Python-list mailing list