WebRequest.Create and timeout

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
 
C

Chad Z. Hower aka Kudzu

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
 
J

Joerg Jooss

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,
 
E

Eric Lawrence [MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top