I believe I understand the practical differences between HttpWebRequest.Timeout
and HttpWebRequest.ReadWriteTimeout
. However, I\'m seeking further<
This problem has been debated on another question, see Adjusting HttpWebRequest Connection Timeout in C#. The discussion made my head spin, so I'll offer my summary.
Although, MSDN explains that the HttpWebRequest.Timeout Property applies to HttpWebRequest.GetResponse
and HttpWebRequest.GetRequestStream
calls, the description is a bit confusing.
Jim Mischel is more helpful: Timeout
"is the time for the server to respond to a request, not the amount of time to wait for the server to respond and send down all of the data." Thus, Timeout
covers establishing a working connection. For large payloads, this does not imply that the request/reply is complete.
ReadWriteTimeout
applies to Read or Write operations to streams that transmit over the connection. E.g. when you Write to the stream returned by GetRequestStream. The connection is already established, but there is a risk that it will break. E.g. the network connection goes down.
The Jim Mischel link has some very good advice on what values to set these timeout. I.e. the default for ReadWriteTimeout
is too long.