I am using winsock to build a HTTP 1.1 compliant client, when I made the request with the header
GET / HTTP/1.1[CRLF]
Host : www.google.com[CRLF][CRLF]
After this header is send using function send(), and when I want to receive the html from the server using recv(), it takes sometimes to get the response, as it's because the connection is still alive, the server will only response until the connection timeout, hence I get the response. If I used connection close, I will get the response immediately.
GET / HTTP/1.1[CRLF]
Connection: close[CRLF]
Host : www.google.com[CRLF][CRLF]
So my question is how can I tell the server it's the end of my request without using the Connection: close header field, so that the server will immediately send response without the connection timeout. or what are the conditions that the server will send response besides, connection closed or connection timeout ? Thanks.
GET / HTTP/1.1[CRLF]
Host : www.google.com[CRLF][CRLF]
After this header is send using function send(), and when I want to receive the html from the server using recv(), it takes sometimes to get the response, as it's because the connection is still alive, the server will only response until the connection timeout, hence I get the response. If I used connection close, I will get the response immediately.
GET / HTTP/1.1[CRLF]
Connection: close[CRLF]
Host : www.google.com[CRLF][CRLF]
So my question is how can I tell the server it's the end of my request without using the Connection: close header field, so that the server will immediately send response without the connection timeout. or what are the conditions that the server will send response besides, connection closed or connection timeout ? Thanks.
Comment