473,651 Members | 3,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebRequest.Crea te and timeout

Bob
I've got to use the http protocol to communicate with another machine as
part of a Web Service using HttpWebRequest and HttpWebResponse . As such,
timing is important.

When I create the HttpWebRequest as shown in the help example:
Dim myReq As HttpWebRequest = _
WebRequest.Crea te("http://www.contoso.com/")

does this actually go out and try and establish some sort of connection
with the remote site? If so, I'll need to spin this off in a thread so I
can create a timeout.

Thanks,

Bob
Nov 18 '05 #1
4 1956
Bob <no********@for evermail.com> wrote in news:MPG.1a9ac5 e95b3fac8698968 0
@news.microsoft .com:
When I create the HttpWebRequest as shown in the help example:
Dim myReq As HttpWebRequest = _
WebRequest.Crea te("http://www.contoso.com/")

does this actually go out and try and establish some sort of connection
with the remote site? If so, I'll need to spin this off in a thread so I
can create a timeout.


Do you mean the Create as opposed to another method? or the WebRequest object
in general?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #2
Bob
In article <Xn************ ******@127.0.0. 1>, cp**@hower.org says...
Bob <no********@for evermail.com> wrote in news:MPG.1a9ac5 e95b3fac8698968 0
@news.microsoft .com:
When I create the HttpWebRequest as shown in the help example:
Dim myReq As HttpWebRequest = _
WebRequest.Crea te("http://www.contoso.com/")

does this actually go out and try and establish some sort of connection
with the remote site? If so, I'll need to spin this off in a thread so I
can create a timeout.


Do you mean the Create as opposed to another method? or the WebRequest object
in general?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Sorry. The Create method.

Bob
Nov 18 '05 #3
Bob wrote:
I've got to use the http protocol to communicate with another machine
as part of a Web Service using HttpWebRequest and HttpWebResponse . As
such, timing is important.

When I create the HttpWebRequest as shown in the help example:
Dim myReq As HttpWebRequest = _
WebRequest.Crea te("http://www.contoso.com/")

does this actually go out and try and establish some sort of
connection with the remote site? If so, I'll need to spin this off in
a thread so I can create a timeout.


No, it can't. Otherwise, you would have a hard time setting HTTP headers
that affect the underlying TCP connection ;-)

Cheers,
--
Joerg Jooss
jo*********@gmx .net

Nov 18 '05 #4
The request isn't executed until you try to get the response stream.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Joerg Jooss" <jo*********@gm x.net> wrote in message
news:uq******** *****@TK2MSFTNG P09.phx.gbl...
Bob wrote:
I've got to use the http protocol to communicate with another machine
as part of a Web Service using HttpWebRequest and HttpWebResponse . As
such, timing is important.

When I create the HttpWebRequest as shown in the help example:
Dim myReq As HttpWebRequest = _
WebRequest.Crea te("http://www.contoso.com/")

does this actually go out and try and establish some sort of
connection with the remote site? If so, I'll need to spin this off in
a thread so I can create a timeout.


No, it can't. Otherwise, you would have a hard time setting HTTP headers
that affect the underlying TCP connection ;-)

Cheers,
--
Joerg Jooss
jo*********@gmx .net

Nov 18 '05 #5

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

Similar topics

5
3631
by: C# Learner | last post by:
Is it possible to create a WebRequest instance and, instead of giving it a URI, give it an actual HTTP request? e.g.: GET / HTTP/1.1 Host: www.google.com CR LF CR LF Thanks in advance.
2
9443
by: news.microsoft.com | last post by:
Hello I try to implement "retry" if connection to web ends with "time out". I want to give a chance to prolong waiting for response. The following code is taken from WebRequest.GetResponse() implementation. All I need to do is to modify line with "to change". My client uses derrived HttpWebRequest. I tried to implement new class MyHttpWebRequest and override GetResponse for it, but how can I create instance of this class. In .Net there...
1
4252
by: aaronfude | last post by:
Hi, I'm running the following code to read a URL into a string. When the url is offline, it times out after about 10 seconds regardless of what I set myRequest.Timeout to. Any suggestions? WebRequest myRequest = WebRequest.Create (inURL); WebResponse myResponse = myRequest.GetResponse();
3
2801
by: Stephane | last post by:
Hi, I'm trying to use PayPal and its Instant Payment Notification. In short, when a payment is made, PayPal send a post to my server and I post it back to PayPal. I'm using WebRequest to do this. I receive the PayPal post, but I can't post it back. It's always giving me a Time out. Here's my code:
0
2211
by: Gordon | last post by:
I use the following code to get source HTML. The second line seems to work when I get no response from a site. However, I want to stop the request if it's taking more than 20 - 30 seconds. I can't seem to make it work. Please point out the mistakes that I have. Thanks code............. WebRequest = WebRequest.Create(URL) WebRequest.Timeout() = RunInfo.ConnectTimeout WebResponse = WebRequest.GetResponse 'WEBRESPONSE IS A PUBLIC OBJECT...
1
2682
by: Christian Urbanczyk | last post by:
Hello! I have a problem with the Webrequest. I've search everywhere to find an answer but it seems that no one has the the problem before. So i hope somebody can help me here! Following Code: _________________________________________ WebRequest wrq = WebRequest.Create(URL); WebResponse wrs = wrq.GetResponse();
0
1422
by: thomasabcd | last post by:
Hi, During the user's registration I wan't to geo-code an address using localsearchmaps.com/geo. For that purpose I use a webrequest like this: string url = "http://www.localsearchmaps.com/geo/?street=" + StreetNumber + "+" + StreetName + "&city=" + City + "&country=DK&google2=1"; System.Net.WebRequest webRequest =
3
2896
by: Jonathan | last post by:
I appreciate anyone's insight on this as I am new to web programming with .NET. I have a simple method which I use to send various HTTP requests to a web server (snippet below). On the first several invocations, the debugger will actually stop in the catch block. However, after a number of invocations (variant) the program just hangs on waiting for the GetResponse(). I would expect the timeout/Webexception to occur. In monitoring...
2
5964
by: kkb | last post by:
Hello! First, I'm sorry because of my english... I'll try to be understandable! I've got a strange problem using .NET 2003 C# and I haven't figured it out for a long time. I'm implementing an application to download images using System.NET classes (webclient, webrequest) asynchronously behind proxy server. The reading method works like this: System.Net.WebClient client=new System.Net.WebClient();
0
8361
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8701
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.