Skip to content

Commit 45638c0

Browse files
Merge pull request #10945 from dotnet/main
Merge main into live
2 parents d8b5b5d + 104acfe commit 45638c0

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

snippets/csharp/System.Net.Http/SocketsHttpHandler/ConnectCallback/program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.IO;
1+
using System;
32
using System.Net;
43
using System.Net.Http;
54
using System.Net.Sockets;
@@ -14,14 +13,17 @@ static async Task Main()
1413

1514
handler.ConnectCallback = async (ctx, ct) =>
1615
{
16+
DnsEndPoint dnsEndPoint = ctx.DnsEndPoint;
17+
IPAddress[] addresses = await Dns.GetHostAddressesAsync(dnsEndPoint.Host, dnsEndPoint.AddressFamily, ct);
1718
var s = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
1819
try
1920
{
2021
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
2122
s.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, 5);
2223
s.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, 5);
2324
s.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, 5);
24-
await s.ConnectAsync(ctx.DnsEndPoint, ct);
25+
26+
await s.ConnectAsync(addresses, dnsEndPoint.Port, ct);
2527
return new NetworkStream(s, ownsSocket: true);
2628
}
2729
catch

xml/System.IO.Pipes/NamedPipeServerStream.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ This example is for the server process, which uses the <xref:System.IO.Pipes.Nam
13771377
## Remarks
13781378
The connecting client's permissions are applied to the remote server. For example, if the connecting client tries to request the contents of a file on the server, the client can request only files that it has sufficient permissions to open.
13791379
1380-
1380+
On Windows, only the thread used for executing the delegate is updated to impersonate the client. On other platforms, all threads from the parent process impersonate the client when `RunAsClient` is called. This behavior affects multi-threaded servers such as the example shown.
13811381
13821382
## Examples
13831383
The following example demonstrates a method to create a pipe server that can respond to multiple simultaneous client requests, and a method for client impersonation. This example creates a <xref:System.IO.Pipes.NamedPipeServerStream> object in a parent process, which then creates multiple threads that wait for <xref:System.IO.Pipes.NamedPipeClientStream> objects to connect. After a client is connected, it supplies a file name to the server and the contents of that file are read and sent back to the client. Because the <xref:System.IO.Pipes.NamedPipeServerStream> impersonates the client when opening the file, the client can request only files that it has sufficient permissions to open.

xml/System/Uri.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,9 +1971,7 @@ If you used an escaped string to construct this instance (for example, `"http://
19711971
</remarks>
19721972
<exception cref="T:System.ArgumentNullException">
19731973
<paramref name="stringToEscape" /> is <see langword="null" />.</exception>
1974-
<exception cref="T:System.UriFormatException">Note: In the <see href="https://go.microsoft.com/fwlink/?LinkID=247912">.NET for Windows Store apps</see> or the <see href="https://learn.microsoft.com/dotnet/standard/cross-platform/cross-platform-development-with-the-portable-class-library">Portable Class Library</see>, catch the base class exception, <see cref="T:System.FormatException" />, instead.
1975-
1976-
The length of <paramref name="stringToEscape" /> exceeds 32766 characters.</exception>
1974+
<exception cref="T:System.UriFormatException">.NET Framework only: The length of <paramref name="stringToEscape" /> exceeds 32766 characters.</exception>
19771975
</Docs>
19781976
</Member>
19791977
<Member MemberName="EscapeString">
@@ -2129,9 +2127,7 @@ If you used an escaped string to construct this instance (for example, `"http://
21292127
</remarks>
21302128
<exception cref="T:System.ArgumentNullException">
21312129
<paramref name="stringToEscape" /> is <see langword="null" />.</exception>
2132-
<exception cref="T:System.UriFormatException">The length of <paramref name="stringToEscape" /> exceeds 32766 characters.
2133-
2134-
Note: In <see href="https://learn.microsoft.com/previous-versions/br230232(v=vs.110)">.NET for Windows Store apps</see> or the <see href="https://learn.microsoft.com/dotnet/standard/cross-platform/cross-platform-development-with-the-portable-class-library">Portable Class Library</see>, catch the base class exception, <see cref="T:System.FormatException" />, instead.</exception>
2130+
<exception cref="T:System.UriFormatException">.NET Framework only: The length of <paramref name="stringToEscape" /> exceeds 32766 characters.</exception>
21352131
</Docs>
21362132
</Member>
21372133
<Member MemberName="Fragment">

0 commit comments

Comments
 (0)