Keep a http connection alive in C#?

后端 未结 5 763
后悔当初
后悔当初 2021-01-12 00:04

How do i keep a connection alive in C#? I\'m not doing it right. Am i suppose to create an HttpWebRequest obj and use it to go to any URLs i need? i dont see a way to visit

5条回答
  •  难免孤独
    2021-01-12 00:52

    Set HttpWebRequest.KeepAlive property True .NET will take care of the rest. It's just database connection pool. Works transparently.

    You can create new connection freely .NET will figure it out that you are connecting an already connected server and will use it. Also depends on your Net.ServicePointManager.DefaultConnectionLimit number it will establish new connections (if you do multhithreading).

提交回复
热议问题