I am making a program that uses winsock, it will be doing different things and one is getting webpages. Anyways I made it to connect to google to test it out and it sends the request for index.html but doesn't receive a response. I'm thinking it's something to do with returning the request. Like if you telnet to google's port 80 and type in "GET /index.html HTTP/1.1" you have to hit Enter/Return twice to send the request. This is how I made and sent my request to google:
Code:
char request[256];
ZeroMemory(request,256);
strcpy(request,"GET /index.html HTTP/1.1");
request[253]='\r';
request[254]='\r';
request[255]='\0';
nret=send(siteSock,request,strlen(request),0);
I add the two '\r' to simulate the hitting enter twice like you have to in telnet. This doesn't invoke any response from google, and it should. I even tried it without the two carriage return characters('\r'). The request is successfully sent and everything, I don't think the lack of response has anything to do with my way of receiving it but I will post it anyways.
Code:
char buf[500];
ZeroMemory(buf,500);
nret=recv(siteSock,buf,500,0);
Any suggestions on why google doesn't respond? Thanks again.