praktikum
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 513B

123456789101112131415161718192021222324252627282930
  1. import socket
  2. SOCKET = socket.socket()
  3. HOST = socket.gethostname()
  4. PORT = 45670
  5. SOCKET.bind((HOST, PORT))
  6. SOCKET.listen()
  7. while True:
  8. (connection, addr) = SOCKET.accept()
  9. print("Server: " + addr[0] + " Port: " + str(addr[1]))
  10. while True:
  11. eingabe = connection.recv(1024)
  12. msg = eingabe.decode("utf-8")
  13. msg = msg.upper()
  14. print(msg)
  15. if msg == "STOP":
  16. break
  17. connection.send(msg.encode("utf-8"))
  18. connection.close()
  19. SOCKET.close()