Lösungen der Aufgaben vom Kurs MEIM1 - Web Engineering von Prof. Hofmann
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.

protocol-client.py 363B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. import socket
  3. HOST = socket.gethostname()
  4. PORT = 60000
  5. SOCKET = socket.socket()
  6. msg = input("Your Message: ")
  7. SOCKET.connect((HOST, PORT))
  8. SOCKET.send(msg.encode("utf-8"))
  9. recv_msg = ""
  10. while True:
  11. data = SOCKET.recv(16)
  12. if data:
  13. recv_msg += data.decode("utf-8")
  14. else:
  15. break
  16. print(recv_msg)
  17. SOCKET.close()