Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

How to control TCP/IP connections used with HttpWebRequest ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jacek - 20 Jul 2005 16:51 GMT
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?
Joerg Jooss - 20 Jul 2005 19:51 GMT
> Hi All!
>
[quoted text clipped - 5 lines]
>
> 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,

Signature

http://www.joergjooss.de
mailto:news-reply@joergjooss.de

Feroze [msft] - 22 Jul 2005 01:17 GMT
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.
Signature

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.
----------------

>> Hi All!
>>
[quoted text clipped - 11 lines]
>
> Cheers,

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.