@@ -1,13 +1,22 @@ | |||
import socket | |||
s = socket.socket() | |||
host = socket.gethostname() | |||
port = 22445 | |||
port = 22225 | |||
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() | |||
#s.send(message.encode('utf-8')) | |||
#bytes = s.recv(1024) | |||
#print (bytes.decode('utf-8')) | |||
#s.close() | |||
message = 'hi' | |||
while message != 'STOP': | |||
message = input('eingabe: ') | |||
s.send(message.encode('utf-8')) | |||
bytes = s.recv(4096) | |||
print(bytes.decode('utf-8')) | |||
else: | |||
print(message) | |||
s.close() |
@@ -2,16 +2,17 @@ import socket | |||
s = socket.socket() | |||
host = socket.gethostname() | |||
port = 22445 | |||
port = 22225 | |||
s.bind((host, port)) | |||
s.listen() | |||
while True: | |||
(connection, addr) = s.accept() | |||
(connection, addr) = s.accept() | |||
msg = 'test' | |||
while msg != 'STOP': | |||
print('verbindung von ', addr) | |||
bytes = connection.recv(1024) | |||
bytes = connection.recv(4096) | |||
msg = bytes.decode('utf-8') | |||
msg = msg.upper() | |||
connection.send(msg.encode('utf-8')) | |||
connection.close() | |||
else: | |||
connection.close() |