This commit is contained in:
khaloufam70043
2019-10-22 15:21:41 +02:00
parent 5b3c211428
commit aa1c1d7331
6 changed files with 69 additions and 16 deletions
+16
View File
@@ -0,0 +1,16 @@
import socket
s = socket.socket() # instantiate
hostname = "my.ohm-hochschule.de"
path = "content/index.jspx"
host = socket.gethostbyname(hostname) # as both code is running on same pc
port = 80
CRLF = "\r\n"
s.connect((host,port))
msg = ( "GET /{} HTTP /1.1{}".format(path, CRLF) + "Host: {}{}".format(hostname, CRLF) + CRLF)
print(msg)
s.send(msg.encode())
bytes = s.recv(4096)
print(bytes.decode())
s.close()