|
|
|
|
|
|
|
|
import socket |
|
|
import socket |
|
|
|
|
|
|
|
|
s = socket.socket () |
|
|
s = socket.socket () |
|
|
host = socket.gethostname() |
|
|
|
|
|
port = 2345 |
|
|
|
|
|
|
|
|
host = socket.gethostbyname('localhost') |
|
|
|
|
|
port = 64432 |
|
|
s.bind((host,port)) |
|
|
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) |
|
|
|
|
|
#msg = baba |
|
|
|
|
|
msg =bytes.decode('utf-8') |
|
|
|
|
|
#test = msg.upper() |
|
|
|
|
|
connection.send(msg.upper().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() |
|
|
|
|
|
|