1234567891011121314151617181920 |
- import socket
-
- s = socket.socket ()
- host = socket.gethostbyname('localhost')
- port = 64432
- s.bind((host,port))
- s.listen()
-
-
- (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()
|