class ThreadedServer(object):

    def __init__(self, host, port):
        self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((self.host, self.port))

def listen(self):
    self.sock.listen(5)
while True:
    pass
How to make a simple multithreaded socket server in Python that remembers clients