|
1234567891011121314151617181920 |
- import socket
- import string
-
- s = socket.socket()
- host = socket.gethostname()
- port = 21345
- s.bind((host, port))
- s.listen()
-
- while True:
- (connection, addr) = s.accept()
- print('Verbindung von ', addr)
- msg = 'Server sagt Hallo'
- connection.send(msg.encode('utf-8'))
- msg = connection.recv(1024)
- msg = (msg.decode('utf-8')).upper()
- connection.send(msg.encode('utf-8'))
- #msg = msg.decode('utf-8')
- #print(msg)
- connection.close()
|