@@ -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() |
@@ -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() |