1

MSDN states WebRequest.Timeout means

The length of time, in milliseconds, until the request times out, or the value Timeout.Infinite to indicate that the request does not time out.

What exactly constitutes a "Timeout"? Is that the maximum amount of time the class will wait before the first byte is returned? Is it the maximum amount of time for the entire request to complete? Is it something else?

I'm asking because I'm using a modified WebClient to download rather large (~1GB) files from a source that sometimes hiccups and takes many minutes to hours to begin sending a response. I want to set the timeout so that successful transfers (that can take up to 20 minutes depending on the connection quality) do not time out, but so that the occasional hiccups will ideally timeout quickly.

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553

1 Answers1

0

The unaccepted answers for Adjusting HttpWebRequest Connection Timeout in C# lead me to examine the ReadWriteTimeout property, which states

Specifically, the ReadWriteTimeout property controls the time-out for the Read method, which is used to read the stream returned by the GetResponseStream method, and for the Write method, which is used to write to the stream returned by the GetRequestStream method.

To specify the amount of time to wait for the request to complete, use the Timeout property.

Community
  • 1
  • 1
Eric J.
  • 147,927
  • 63
  • 340
  • 553