none
How does the timeout property practically work for a webrequest like this RRS feed

  • Question

  • Hello,

    I have a general question about the timeout property for a webrequest like below. I will assume a scenario to understand my question with a 15 seconds timeout.

    Let us say that we make a request this time to a server: 15:00:00

    The server do update a value EACH second like this:

    15:00:00 (Value: 1)

    15:00:01 (Value: 2)

    15:00:02 (Value: 3)

    15:00:03 (Value: 4)

    15:00:04 (Value: 5)

    Now assume that it took 4 seconds to GET the reponse. So we get the response on time: 15:00:04.

    Now is my question:

    Do we return the Value 1 or 5 from the server? How does this work practically?

    var request = (HttpWebRequest)WebRequest.Create("http://serverurl.com"); //returns JSON response               
    request.Timeout = 15000;

    Sunday, April 3, 2016 1:47 PM

Answers

  • Hi Silvers2,

    Timeout means If the resource is not returned from server within the time-out period, the request throws a WebException with the Status property set to WebExceptionStatus.Timeout.

    >>"The server do update a value EACH second like this:"

    This behavior occurs in the server side. The response from server occurred at a time.

    >>"Now assume that it took 4 seconds to GET the reponse. So we get the response on time: 15:00:04."

    It means we get the response at 15:00:04. But we are unable to determine when the server start to response.

    >>"Do we return the Value 1 or 5 from the server? How does this work practically?"

    It is uncertain. We need to get the response value from the response message.

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 4, 2016 2:22 AM
    Moderator