From e77996535ffd7815f3404b3583e23578236fdf28 Mon Sep 17 00:00:00 2001 From: hartwigja62500 Date: Mon, 15 Oct 2018 17:12:01 +0200 Subject: [PATCH] 1.termin --- Prakt1_Socket.py | 9 +++++---- prakt1_socket_client | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 prakt1_socket_client diff --git a/Prakt1_Socket.py b/Prakt1_Socket.py index 7840e35..b29980e 100644 --- a/Prakt1_Socket.py +++ b/Prakt1_Socket.py @@ -1,4 +1,5 @@ import socket +import string s = socket.socket() host = socket.gethostname() @@ -12,8 +13,8 @@ while True: msg = 'Server sagt Hallo' connection.send(msg.encode('utf-8')) msg = connection.recv(1024) - - #connection.send(msg) - msg = msg.decode('utf-8') - print(msg) + msg = (msg.decode('utf-8')).upper() + connection.send(msg.encode('utf-8')) + #msg = msg.decode('utf-8') + #print(msg) connection.close() \ No newline at end of file diff --git a/prakt1_socket_client b/prakt1_socket_client new file mode 100644 index 0000000..f3dba5e --- /dev/null +++ b/prakt1_socket_client @@ -0,0 +1,16 @@ +import socket + +s = socket.socket() +host = socket.gethostname() +port = 21345 + +s.connect((host, port)) +bytes = s.recv(1024) +print(bytes.decode('utf-8')) + +msg = input('Hier Eingabe: ') +msg = msg.encode('utf-8') +s.send(msg) +bytes = s.recv(1024) +print(bytes.decode('utf-8')) +s.close() \ No newline at end of file