|
|
|
|
|
|
|
|
import socket |
|
|
import socket |
|
|
|
|
|
|
|
|
s = socket.socket() |
|
|
s = socket.socket() |
|
|
host = socket.gethostname() |
|
|
|
|
|
port = 13345 |
|
|
|
|
|
s.bind((host , port)) |
|
|
|
|
|
|
|
|
host = socket.gethostbyname('localhost') |
|
|
|
|
|
port = 22225 |
|
|
|
|
|
s.bind((host, port)) |
|
|
s.listen() |
|
|
s.listen() |
|
|
while True: |
|
|
|
|
|
(connection, addr )= s.accept() |
|
|
|
|
|
print('verbindung von', addr) |
|
|
|
|
|
msg= 'Danke für das vorbeischauen!' |
|
|
|
|
|
bytes= connection.recv(1024) |
|
|
|
|
|
message = bytes.decode('utf-8') |
|
|
|
|
|
sendmessage= message.upper() |
|
|
|
|
|
connection.send(sendmessage.encode('utf-8')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(connection, addr) = s.accept() |
|
|
|
|
|
msg = 'test' |
|
|
|
|
|
while msg != 'STOP': |
|
|
|
|
|
print('verbindung von ', addr) |
|
|
|
|
|
bytes = connection.recv(4096) |
|
|
|
|
|
msg = bytes.decode('utf-8') |
|
|
|
|
|
msg = msg.upper() |
|
|
|
|
|
connection.send(msg.encode('utf-8')) |
|
|
|
|
|
else: |
|
|
connection.close() |
|
|
connection.close() |