Hello everyone,

I am using the code in the following website (http://www.adp-gmbh.ch/win/misc/sockets.html#test) that is a ready Socket and Client class for connecting to a website. But in the Client.cpp code, if I put a query for Google instead of the host name in the send() method, I get a bad response.

s.SendLine("GET / HTTP/1.0");
s.SendLine("Host: www.google.com/search?hl=en&q=chair");

does not work, and

s.SendLine("GET / HTTP/1.0");
s.SendLine("Host: www.google.com");

works... And SendLine is just a call to send() in WinSock2.h.

Anyone has any ideas?


What is the response you are getting? I had a similar problem - I did not get a bad response - in fact the response string was telling me that I was connected. Turned out that the web-site I connected to used a cookie to maintain the session state. The second call immediately after the first send request returned the required result. Is that your problem?