while len(data):
    data = self.request.recv(1024)
self.request.send(data)
print('Client exited')
self.request.close()


class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
    pass
server = ThreadedTCPServer(('', 1520), service)
server.serve_forever()
Creating a multithreaded server using SocketServer framework in python