WebRequest.Create and timeout

  • Thread starter Thread starter Bob
  • Start date Start date
B

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.Create("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
 
Bob said:
When I create the HttpWebRequest as shown in the help example:
Dim myReq As HttpWebRequest = _
WebRequest.Create("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/
"Programming is an art form that fights back"


ELKNews - Get your free copy at http://www.atozedsoftware.com
 
Bob said:
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.Create("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,
 
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.
 
Back
Top