I have tried to send HTTP requests through TCP by connecting to a site, but I don't get any reply in return when I try to receive data from the server .
Here's my code in Python:
import socket
s = socket.socket() ;
s.connect(('google.com' , 80)) ;
s.send(b"GET / HTTP/1.1\r\nHost: google.com\r\n") ;
s.recv(1024) # The program waits here infinitely meaning I haven't got a reploy from server.
What am I doing wrong? How do I get the html page using a TCP or UDP socket?
Also, since HTTP is connectionless, does it mean I should only use UDP and not TCP?