from socket import * from threading import Thread server = socket(AF_INET,SOCK_STREAM) server.bind(('127.0.0.1',8080)) server.listen(5) def dask(conn): while True: try: date = conn.recv(1024) if len(date) == 0: break print(date.decode('utf-8')) conn.send(date.upper()) except Exception as f: print(f) break conn.close() if __name__ == '__main__': while True: conn,client_addrs = server.accept() t = Thread(target=dask,args=(conn,)) t.start()