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.

ohm.server.py 421B

12345678910111213141516
  1. import socket
  2. s = socket.socket() # instantiate
  3. hostname = "my.ohm-hochschule.de"
  4. path = "content/index.jspx"
  5. host = socket.gethostbyname(hostname) # as both code is running on same pc
  6. port = 80
  7. CRLF = "\r\n"
  8. s.connect((host,port))
  9. msg = ( "GET /{} HTTP /1.1{}".format(path, CRLF) + "Host: {}{}".format(hostname, CRLF) + CRLF)
  10. print(msg)
  11. s.send(msg.encode())
  12. bytes = s.recv(4096)
  13. print(bytes.decode())
  14. s.close()