From dd72d45aefcad7c981dd3057713ef184994e3075 Mon Sep 17 00:00:00 2001 From: tranngoctu63599 Date: Tue, 15 Oct 2019 15:17:45 +0200 Subject: [PATCH] v2 --- .idea/vcs.xml | 6 ++++++ clie_file.py | 5 +++-- serv_file.py | 10 +++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/clie_file.py b/clie_file.py index 555dedc..af8c2b3 100644 --- a/clie_file.py +++ b/clie_file.py @@ -5,9 +5,10 @@ eingabe = input("Bitte etwas eingeben: ") s = socket.socket() host = socket.gethostname() port = 12345 - s.connect((host, port)) - s.send(eingabe.encode('utf-8')) +msgRes = s.recv(1024) +print(msgRes.decode('utf-8')) + s.close() diff --git a/serv_file.py b/serv_file.py index 7c9707d..ed833b1 100644 --- a/serv_file.py +++ b/serv_file.py @@ -9,7 +9,11 @@ s.listen() while True: (connection, addr) = s.accept() - bytes = s.recv(1024) - print(bytes.decode('utf-8')) + msg = connection.recv(1024) + msgReturn = msg.decode('utf-8').upper() + connection.send(msgReturn.encode('utf-8')) + connection.close() + + + - connection.close() \ No newline at end of file