By default, HttpWebRequest tries to use persistent connections. Now, if the
server is closing the connection after each request, then the client will be
forced to create a new one.
Also, are you tweaking any connection related properties on the webrequest
object, like: KeepAlive, ConnectionGroupName etc? Depending on what you set
there, it might affect connection reuse also
To answer your question, setting request.KeepAlive=true causes connection to
be reused.
--
feroze
-----------------
This posting is provided as-is. It offers no warranties and assigns no
rights.
See
http://weblogs.asp.net/feroze_daud for System.Net related posts.
----------------
"Joerg Jooss" <news-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Jacek wrote:
>
>> Hi All!
>>
>> After checking with packet sniffer that for every created
>> HttpWebRequest / HttpWebResponse followed by Close() call my box
>> creates new TCP/IP connection I just wonder if there is a way to use
>> single long lasting TCP/IP connection with a given server for
>> multiple HttpWebRequest / HttpWebResponse operations.
>>
>> Any ideas?
>
> Can you post some code? Reusing a TCP connection is what persistent
> connections in HTTP 1.1 (or keep-alive in 1.0) are all about, and these
> features are all implemented by HttpWebRequest.
>
> Cheers,
>
> --
> http://www.joergjooss.de
> mailto:news-(E-Mail Removed)