When connecting to a HTTP server (and I think you connected to one when saying Google) you must send valid requests to get an answer. This includes a trailing CR-LF pair (see
RFC 2616[
^]). The
gets()
function will remove the entered new line character. So the server receives your data but waits for the terminating CR-LF pair to process the request and answer.
But even when you add sending a CR-LF pair after your entered command, your code will probably fail. You are passing the length of the entered string as buffer size to your
recv()
call. You should read one of the many tutorials about Winsock to implement a receive function that handles received data of variable length.
You should also always check the return values of the
send()
and
recv()
calls.