So, there are two timeout properties that can be set on HttpClient : HttpClient.TimeOut and WebRequestHandler.ReadWriteTimeout .
The first one is just a timeout for the entire request / response, so if the download / download takes longer, Iโm out of luck and is cut off in the middle of the transfer, and no questions were asked. Obviously, this can be overridden by setting the timeout to Infinite, but I'm not sure what the consequences are.
Now the last one (ReadWriteTimeOut) - at least to my understanding - should extend right up to NetworkStream , where it affects how long the request / response flow can block (idle) before the timeout expires.
HttpClient uses asynchronous versions of the HttpWebRequest methods, but as stated here :
In the case of asynchronous requests, the client application is responsible for implementing its timeout mechanism.
It doesnโt explain at all what kind of timeout mechanism they have in mind (the idle timeout timeout of the network stream for the whole HTTP GET? Etc.), so it bothers me a lot.
So my question is: how exactly does HttpClient handle network / protocol timeouts? I want to use HttpClient to upload / download potentially large files, so for this I set HttpClient.TimeOut to infinity. But I am concerned that in doing so, the application runs the risk of endlessly waiting for any event that the server / network refuses to complete.
Paya
source share