How do I measure the elapsed time of the actual HttpWebResponse versus passing the HttpWebRequest?

I have an application that sends a large file to a provider API and receives a response. It does it like this:

HttpWebRequest webRequest = BuildWebRequest(..., requestParams.Data, ...);
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();

      

I would like to measure the elapsed time of just the response itself (excluding the time it takes to upload / post the multipart / form big data).

I don't see any combination of HttpWebRequest methods or events that I can use to decouple the request loading from the response loading.

Any ideas?

0


source to share


3 answers


If you are not submitting the file, the request timing will be trivial.



0


source


The challenge code cannot be passed when the response is sent from the server. The best you can get is when the first data from the response becomes available in the response stream.



0


source


If this is just for testing, I would use Fiddler to track traffic. It can show you the type of information you want.

Here is an example of the output of the webservice shortcut that was captured by the fiddler:

== TIMING INFO ============
ClientConnected:        15:41:07:2804
ClientDoneRequest:      15:41:07:6398
Gateway Determination:  0ms
DNS Lookup:         0ms
TCP/IP Connect:         0ms
ServerGotRequest:       15:41:07:6398
ServerBeginResponse:    15:41:07:7804
ServerDoneResponse: 15:41:07:7804
ClientBeginResponse:    15:41:07:7804
ClientDoneResponse: 15:41:07:7804

      

If you've never used a fiddler to make web service calls, make sure you add the following to your web.config:

  <system.net>
    <defaultProxy>
      <proxy  proxyaddress="http://127.0.0.1:8888" />
    </defaultProxy>
  </system.net>

      

0


source







All Articles