This commit is contained in:
Nadege 2019-10-15 16:15:16 +02:00
parent 17078b849a
commit 1cb2a8973e
2 changed files with 30 additions and 0 deletions

13
client.py Normal file
View File

@ -0,0 +1,13 @@
import socket
s = socket.socket()
host = socket.gethostname()
port = 22445
s.connect((host, port))
message = input('eingabe: ')
#bytes = s.sendmsg(message.encode('utf-8'))
test = s.send(message.encode('utf-8'))
msg = s.recv(1024)
print (msg.decode('utf-8'))
s.close()

17
server.py Normal file
View File

@ -0,0 +1,17 @@
import socket
s = socket.socket()
host = socket.gethostname()
port = 22445
s.bind((host, port))
s.listen()
while True:
(connection, addr) = s.accept()
print('verbindung von ', addr)
bytes = connection.recv(1024)
msg = bytes.decode('utf-8')
msg = msg.upper()
connection.send(msg.encode('utf-8'))
connection.close()