Ravindra Reddy
Ravindra Reddy

Reputation: 7

HttpClient object Timeout property vs DefaultRequestHeaders Keep-alive

Could you please let me know the difference between HttpClient object Timeout property vs the DefaultRequestHeaders "Keep-Alive".

httpClient.Timeout = TimeSpan.FromMinutes(10);

vs

httpClient.DefaultRequestHeaders.Add("Connection", "Keep-Alive"); httpClient.DefaultRequestHeaders.Add("Keep-Alive", "600");

Upvotes: 0

Views: 256

Answers (1)

CodeCaster
CodeCaster

Reputation: 151654

The timeout is the time the client will wait for a response. Keep-alive is for reusing an already opened TCP connection for subsequent HTTP requests.

Upvotes: 1

Related Questions