import socket HOST = '127.0.0.1' PORT = 2000 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) print('Conectado con éxito') while True: message = input("Enter a message (or 'exit' to quit): ") if message.lower() == 'exit': break s.sendall(message.encode('utf-8')) num_bytes_sent = len(message.encode('utf-8')) print(f"Sent {num_bytes_sent} bytes") data = s.recv(1024) # línea bloqueante print('Recibido:', repr(data.decode('utf-8')))