#!/usr/bin/env python3 import socket HOST = '127.0.0.1' # Hostname oder IP des Echo-Servers eintragen # PORT = 65432 # Port des Servers eintragen PORT = 50000 host = input('Server-IP [' + HOST + ']: ') port = input('Server-Port [' + str(PORT) + ']: ') if host != '': HOST = host if port != '': PORT = int(port, 10) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) written = '' while True: written = input('Your message (type "exit" to exit): ') if written == 'exit': break; s.sendall(bytearray(written, 'UTF-8')) data = s.recv(1024) print('Received ', repr(data)) print('Client closed')