Skip to content

Commit 58e8532

Browse files
Copilotmeaghanlewis
andcommitted
Apply freshness edits to task-parallel-library-tpl.md, httpclient-guidelines.md, and socket-services.md
Co-authored-by: meaghanlewis <[email protected]>
1 parent 3d634e5 commit 58e8532

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

docs/fundamentals/networking/http/httpclient-guidelines.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: HttpClient guidelines for .NET
33
description: Learn about using HttpClient instances to send HTTP requests and how you can manage clients using IHttpClientFactory in your .NET apps.
44
author: gewarren
55
ms.author: gewarren
6-
ms.date: 03/08/2024
6+
ms.date: 10/22/2025
7+
ai-usage: ai-assisted
78
---
89

910
# Guidelines for using HttpClient
@@ -12,7 +13,7 @@ The <xref:System.Net.Http.HttpClient?displayProperty=fullName> class sends HTTP
1213

1314
## DNS behavior
1415

15-
<xref:System.Net.Http.HttpClient> only resolves DNS entries when a connection is created. It does not track any time to live (TTL) durations specified by the DNS server. If DNS entries change regularly, which can happen in some scenarios, the client won't respect those updates. To solve this issue, you can limit the lifetime of the connection by setting the <xref:System.Net.Http.SocketsHttpHandler.PooledConnectionLifetime> property, so that DNS lookup is repeated when the connection is replaced. Consider the following example:
16+
<xref:System.Net.Http.HttpClient> only resolves DNS entries when a connection is created. It doesn't track any time to live (TTL) durations specified by the DNS server. If DNS entries change regularly, which can happen in some scenarios, the client won't respect those updates. To solve this issue, limit the lifetime of the connection by setting the <xref:System.Net.Http.SocketsHttpHandler.PooledConnectionLifetime> property, so that DNS lookup is repeated when the connection is replaced. Consider this example:
1617

1718
```csharp
1819
var handler = new SocketsHttpHandler
@@ -22,7 +23,7 @@ var handler = new SocketsHttpHandler
2223
var sharedClient = new HttpClient(handler);
2324
```
2425

25-
The preceding `HttpClient` is configured to reuse connections for 15 minutes. After the timespan specified by <xref:System.Net.Http.SocketsHttpHandler.PooledConnectionLifetime> has elapsed and the connection has completed its last associated request (if any), this connection is closed. If there are any requests waiting in the queue, a new connection is created as needed.
26+
The preceding `HttpClient` is configured to reuse connections for 15 minutes. After the timespan specified by <xref:System.Net.Http.SocketsHttpHandler.PooledConnectionLifetime> has elapsed and the connection has completed its last associated request (if any), the connection is closed. If there are any requests waiting in the queue, a new connection is created as needed.
2627

2728
The 15-minute interval was chosen arbitrarily for illustration purposes. You should choose the value based on the expected frequency of DNS or other network changes.
2829

docs/fundamentals/networking/sockets/socket-services.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use Sockets to send and receive data over TCP
33
description: Learn how the Socket class exposes socket network communication functionality in .NET.
44
author: IEvangelist
55
ms.author: dapine
6-
ms.date: 11/30/2022
6+
ms.date: 10/22/2025
77
helpviewer_keywords:
88
- "application protocols, sockets"
99
- "sending data, sockets"
@@ -16,6 +16,7 @@ helpviewer_keywords:
1616
- "protocols, sockets"
1717
- "Internet, sockets"
1818
- "client sockets"
19+
ai-usage: ai-assisted
1920
---
2021

2122
# Use Sockets to send and receive data over TCP

docs/standard/parallel-programming/task-parallel-library-tpl.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
title: "Task Parallel Library (TPL)"
33
description: Explore the Task Parallel Library (TPL), a set of public types and APIs to simplify the process of adding parallelism & concurrency to applications in .NET.
4-
ms.date: "08/01/2022"
4+
ms.date: "10/22/2025"
55
ms.custom: devdivchpfy22
66
helpviewer_keywords:
77
- ".NET, concurrency in"
88
- ".NET, parallel programming in"
99
- "Parallel Programming"
1010
ms.assetid: b8f99f43-9104-45fd-9bff-385a20488a23
11+
ai-usage: ai-assisted
1112
---
1213
# Task Parallel Library (TPL)
1314

14-
The Task Parallel Library (TPL) is a set of public types and APIs in the <xref:System.Threading?displayProperty=nameWithType> and <xref:System.Threading.Tasks?displayProperty=nameWithType> namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications. The TPL dynamically scales the degree of concurrency to use all the available processors most efficiently. In addition, the TPL handles the partitioning of the work, the scheduling of threads on the <xref:System.Threading.ThreadPool>, cancellation support, state management, and other low-level details. By using TPL, you can maximize the performance of your code while focusing on the work that your program is designed to accomplish.
15-
16-
In .NET Framework 4, the TPL is the preferred way to write multithreaded and parallel code. However, not all code is suitable for parallelization. For example, if a loop performs only a small amount of work on each iteration, or it doesn't run for many iterations, then the overhead of parallelization can cause the code to run more slowly. Furthermore, parallelization, like any multithreaded code, adds complexity to your program execution. Although the TPL simplifies multithreaded scenarios, we recommend that you have a basic understanding of threading concepts, for example, locks, deadlocks, and race conditions, so that you can use the TPL effectively.
15+
The Task Parallel Library (TPL) is a set of public types and APIs in the <xref:System.Threading?displayProperty=nameWithType> and <xref:System.Threading.Tasks?displayProperty=nameWithType> namespaces. The purpose of the TPL is to make developers more productive by simplifying the process of adding parallelism and concurrency to applications. The TPL dynamically scales the degree of concurrency to use all the available processors most efficiently. In addition, the TPL handles the partitioning of the work, the scheduling of threads on the <xref:System.Threading.ThreadPool>, cancellation support, state management, and other low-level details. Using TPL, you can maximize the performance of your code while focusing on the work that your program is designed to accomplish.
16+
17+
In .NET Framework 4, the TPL is the preferred way to write multithreaded and parallel code. However, not all code is suitable for parallelization. For example, if a loop performs only a small amount of work on each iteration, or it doesn't run for many iterations, then the overhead of parallelization can cause the code to run more slowly. Furthermore, parallelization, like any multithreaded code, adds complexity to your program execution. Although the TPL simplifies multithreaded scenarios, we recommend that you have a basic understanding of threading concepts, for example, locks, deadlocks, and race conditions, so that you can use the TPL effectively.
1718

1819
## Related articles
1920

0 commit comments

Comments
 (0)