1

I am trying to implement an HTTP socket server in python. Up to now al works great except one thing: In my first design I made that every client request opens a new request handler thread whic means - no persistent connection. I want to support keep alive connection - all the request/response on the same tcp stream.

I can't put my code here because it's not approachable to me right now (other computer), but the conecpt is that:

while 1:
    #accept connections from outside
    (clientsocket, address) = serversocket.accept()
    #now do something with the clientsocket
    #in this case, we'll pretend this is a threaded server
    ct = client_thread(clientsocket)
    ct.run()
4

0 回答 0