diff --git a/demo_client.py b/demo_client.py index 2d0fab7..918999f 100644 --- a/demo_client.py +++ b/demo_client.py @@ -1,16 +1,24 @@ import socket -eingabe = input("Bitte etwas eingeben:") +#eingabe = input("Bitte etwas eingeben:") s = socket.socket() host = socket.gethostname() port = 12346 - s.connect((host, port)) -s.send(eingabe.encode('utf-8')) -#bytes = s.recv(1024) -#print(bytes.decode('utf-8')) -print('Gesendet') -msg3 = s.recv(1024) -s.close() \ No newline at end of file + + +#s.connect((host, port)) +#s.send(eingabe.encode('utf-8')) +##bytes = s.recv(1024) +##print(bytes.decode('utf-8')) +#print('Gesendet') +#msg3 = s.recv(1024) +#print(msg3.decode('utf-8')) +#s.close() + +while True: + eingabe = input("Bitte etwas eingeben:") + (connection, addr) = s.accept() + connection.send(eingabe.encode('utf-8')) \ No newline at end of file diff --git a/demo_server.py b/demo_server.py index cd00598..721da6e 100644 --- a/demo_server.py +++ b/demo_server.py @@ -10,9 +10,18 @@ s.listen() while True: (connection, addr) = s.accept() print("Verbindung von ", addr) - msg2 = connection.recv(1024) - new_msg2 = msg2.decode('utf-8') .upper() - print(new_msg2) - connection.send(new_msg2.encode('utf-8')) - #connection.send(msg.encode('utf-8')) - connection.close() + #msg2 = connection.recv(1024) + #new_msg2 = msg2.decode('utf-8') .upper() + #print(new_msg2) + #connection.send(new_msg2.encode('utf-8')) + ##connection.send(msg.encode('utf-8')) + #connection.close() + + msg = connection.recv(1024) + new_msg = msg2.decode('utf-8').upper() + + if new_msg == "STOP": + break + + +