Fork a SocketServer on NT

Werner Schiendl ws-news at
Thu Nov 15 14:11:58 CET 2001


I think the threading module provides basic and portable threading.
See the class Thread in there.

if you have a function to handle the connection something like (untested)

def yourHandlerFunction(handlersock, addr):

import threading
threading.Thread(target=yourHandlerFunction, args=(handlersock,

should get you started.


"GT" <guy.theisen at> wrote in message
news:e253b770.0111150446.5dc9ef39 at
> Hi,
>   I'm trying to fork a SocketServer on NT. But I don't know how to do
> this. The   os.fork doesn't work on NT. I have this example from the
> in O'Reilly book "Python for Win32".
>     serversock = socket(AF_INET, SOCK_STREAM)
>     serversock.bind((HOST, PORT))
>     serversock.listen(5)
>     print 'socket listening for connections...'
>     while 1:
>         handlersock, addr = serversock.accept()
>         #now do something with the handler socket
>         print 'SocketServer connected by', addr
>         data = handlersock.recv(1024)
>         handlersock.send(data)
>         handlersock.close()
>         print 'SocketServer closed ...'
> Can anyone show me how to solve this  .....
> thanks for any help,
> GT

More information about the Python-list mailing list