You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

server.py 383B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1234567891011121314151617181920
  1. import socket
  2. s = socket.socket ()
  3. host = socket.gethostbyname('localhost')
  4. port = 64432
  5. s.bind((host,port))
  6. s.listen()
  7. (connection, addr) = s.accept()
  8. msg = 'test'
  9. while msg != 'STOP':
  10. print('verbindung von ', addr)
  11. bytes = connection.recv(4096)
  12. msg = bytes.decode('utf-8')
  13. msg = msg.upper()
  14. connection.send(msg.encode('utf-8'))
  15. else:
  16. connection.close()