import socket | |||||
eingabe = input("Bitte etwas eingeben: ") | |||||
s = socket.socket() | |||||
host = socket.gethostname() | |||||
port = 12345 | |||||
s.connect((host, port)) | |||||
while eingabe != "STOP": | |||||
s.send(eingabe.encode('utf-8')) | |||||
eingabe = input("Bitte etwas eingeben: ") | |||||
else: | |||||
s.close() |
import socket | |||||
s = socket.socket() | |||||
host = socket.gethostname() | |||||
port = 12345 | |||||
s.bind((host, port)) | |||||
s.listen() | |||||
while True: | |||||
(connection, addr) = s.accept() | |||||
msg = connection.recv(1024) | |||||
msgReturn = msg.decode('utf-8').upper() | |||||
connection.send(msgReturn.encode('utf-8')) | |||||
connection.close() |