Why is the HttpClient constructor not internal? #59343
-
I often see it used as a concrete instantiation with a using statement, but this doesn't manage sockets and leads to stale DNS lookups and socket exhaustion. What is the reason for allowing this usage please? If it were internal developers could not make that mistake. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Socket is managed by connection pool which is used by Although it's typically shared during application lifetime, short-lived ones are also necessary for application which only uses network very rarely. |
Beta Was this translation helpful? Give feedback.
Socket is managed by connection pool which is used by
HttpClientHandler
. EachHttpClient
has its own connection pool.Although it's typically shared during application lifetime, short-lived ones are also necessary for application which only uses network very rarely.