sockets in python import socketserver class mytcphandler(socketserver baserequesthandler)""the requesthandler class for the server ""def __init__(selfrequestclient_addressserver)print('setup names and offices'self addresses {'john'' ''denise'' ''phoebe'' ''adam'' 'super(__init__(requestclient_addressserverdef handle(self)print('in handle'self request is the tcp socket connected to the client data self request recv( decode(print('data received:'datakey str(dataupper(response self addresses[keyprint('response:'responsesend the result back to the client self request sendall(response encode()def main()print('starting server'server_address ('localhost' print('creating server'server socketserver tcpserver(server_addressmytcphandlerprint('activating server'server serve_forever(if __name__ ='__main__'main(note that the previous client application does not need to change at allthe server changes are hidden from the client howeverthis is still single threaded server we can very simply make it into multi-threaded server (one that can deal with multiple requests concurrentlyby mixing the socketserver threadingmixin into the tcpserver this can be done by defining new class that is nothing more than class that extends both