473,508 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetResponse delay

I do some peeking at files on the web in my program with code such as:

WebRequest wr = WebRequest.Create(url);
WebResponse r = wr.GetResponse();

I've noticed that the first time GetResponse is executed, it takes some 3 to
4 seconds. Repeating the same code in the same run is almost immediate. So
why the delay the first time this is executed on each run? And can I do
anything about it?
Mar 6 '06 #1
4 1733
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl...
I do some peeking at files on the web in my program with code such as:

WebRequest wr = WebRequest.Create(url);
WebResponse r = wr.GetResponse();

I've noticed that the first time GetResponse is executed, it takes some 3
to 4 seconds. Repeating the same code in the same run is almost immediate.
So why the delay the first time this is executed on each run? And can I do
anything about it?


This is a very normal thing for PCs. Haven't you ever used a PC before and
noticed that doing practically *anything* takes longer the first time?

Michael
Mar 6 '06 #2
I've been using PCs for 20 years pal. Doesn't explain why the same url in a
web browser appears instantly (it's only a small text file) yet GetResponse
takes 4 seconds - there must be a reason for it, and I assume you don't know
it.

"Michael C" <no****@nospam.com> wrote in message
news:uZ*************@TK2MSFTNGP15.phx.gbl...
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl...
I do some peeking at files on the web in my program with code such as:

WebRequest wr = WebRequest.Create(url);
WebResponse r = wr.GetResponse();

I've noticed that the first time GetResponse is executed, it takes some 3
to 4 seconds. Repeating the same code in the same run is almost
immediate. So why the delay the first time this is executed on each run?
And can I do anything about it?


This is a very normal thing for PCs. Haven't you ever used a PC before and
noticed that doing practically *anything* takes longer the first time?

Michael

Mar 6 '06 #3
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
"Michael C" <no****@nospam.com> wrote in message
news:uZ*************@TK2MSFTNGP15.phx.gbl...
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl...
I do some peeking at files on the web in my program with code such as:

WebRequest wr = WebRequest.Create(url);
WebResponse r = wr.GetResponse();

I've noticed that the first time GetResponse is executed, it takes some 3 to 4 seconds. Repeating the same code in the same run is almost
immediate. So why the delay the first time this is executed on each run? And can I do anything about it?
This is a very normal thing for PCs. Haven't you ever used a PC before and noticed that doing practically *anything* takes longer the first time?

Michael

I've been using PCs for 20 years pal. Doesn't explain why the same url in

a web browser appears instantly (it's only a small text file) yet GetResponse takes 4 seconds - there must be a reason for it, and I assume you don't know it.


I see to possibilities.

1) There is a high overhead setting up the HTTP connection and the second
time its reused...
2) The immediate code is compiled the first time and the second time its
already present. That might be a side-effect of dotNET.
3) A round-trip to the server is expensive and the second time the cache is
used (not too likely that this is the case).

Of course combinations are possible too...

- Joris
Mar 6 '06 #4
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
I've been using PCs for 20 years pal. Doesn't explain why the same url in
a web browser appears instantly (it's only a small text file) yet
GetResponse takes 4 seconds - there must be a reason for it, and I assume
you don't know it.


It's called cache my friend.

Michael
Mar 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
18804
by: Des L. Davis | last post by:
System: Dell PowerEdge Server with 3 GB RAM, 2.4 GHz Celeron Software: Microsoft SQL Server 2000 Enterprise running on Windows 2003 Server Software: Microsoft SQL Server 2000 Enterprise running on...
6
6120
by: Jonathan | last post by:
Calling the System.Net.WebResponse.GetResponse method (see code below) results in the following error: System.Net.WebException: The underlying connection was closed: An unexpected error occurred...
6
5534
by: lucifer | last post by:
hi i need to insert delay in my program what function should i use the old delay is not supported by the VC6
5
35858
by: Nathan | last post by:
This is a copy of a message at microsoft.public.dotnet.framework.clr: THE CODE: I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the...
1
12575
by: Jeff B | last post by:
I'm trying to create a simple screen scraping application and I kept getting a System.Net.WebException thrown back with a message of "The operation has timed-out." At first I thought it was some...
8
13547
by: Morgan Cheng | last post by:
I happens to surf to http://www.codeproject.com/cs/internet/Crawler.asp, which claims that WebRequest.GetResponse() will block other thread calling this function until WebResponse.Close() is...
5
4853
by: mr.newsgroupguy | last post by:
I am working in C# .NET 1.1. My app has a button on its main form that checks to see if it has access to a file on our server, just an XML file. On our server we are running W2K IIS with a...
4
5183
by: =?Utf-8?B?SmltIE93ZW4=?= | last post by:
Hi, I've run into a set of errors I don't understand coming back from HttpWebRequest.GetResponse, In one case, null is returned from the request without an Exception and in the other the request...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.