Skip to content

Commit

Permalink
Experiment with named pipes transport
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Nov 2, 2022
1 parent c8d252d commit ee10898
Show file tree
Hide file tree
Showing 36 changed files with 1,739 additions and 27 deletions.
41 changes: 41 additions & 0 deletions AspNetCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAppSample", "src\Framewo
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F43CC5EA-6032-4A11-A9B2-6D48CB5EB082}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Transport.NamedPipes", "Transport.NamedPipes", "{F057512B-55BF-4A8B-A027-A0505F8BA10C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes", "src\Servers\Kestrel\Transport.NamedPipes\src\Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.csproj", "{10173568-A65E-44E5-8C6F-4AA49D0577A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.Tests", "src\Servers\Kestrel\Transport.NamedPipes\test\Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.Tests.csproj", "{97C7D2A4-87E5-4A4A-A170-D736427D5C21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -10513,6 +10519,38 @@ Global
{A8E2AB77-8F57-47C2-A961-2F316793CAFF}.Release|x64.Build.0 = Release|Any CPU
{A8E2AB77-8F57-47C2-A961-2F316793CAFF}.Release|x86.ActiveCfg = Release|Any CPU
{A8E2AB77-8F57-47C2-A961-2F316793CAFF}.Release|x86.Build.0 = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|arm64.ActiveCfg = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|arm64.Build.0 = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|x64.ActiveCfg = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|x64.Build.0 = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Debug|x86.Build.0 = Debug|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|Any CPU.Build.0 = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|arm64.ActiveCfg = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|arm64.Build.0 = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|x64.ActiveCfg = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|x64.Build.0 = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|x86.ActiveCfg = Release|Any CPU
{10173568-A65E-44E5-8C6F-4AA49D0577A1}.Release|x86.Build.0 = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|arm64.ActiveCfg = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|arm64.Build.0 = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|x64.ActiveCfg = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|x64.Build.0 = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|x86.ActiveCfg = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Debug|x86.Build.0 = Debug|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|Any CPU.Build.0 = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|arm64.ActiveCfg = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|arm64.Build.0 = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|x64.ActiveCfg = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|x64.Build.0 = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|x86.ActiveCfg = Release|Any CPU
{97C7D2A4-87E5-4A4A-A170-D736427D5C21}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -11378,6 +11416,9 @@ Global
{890B5210-48EF-488F-93A2-F13BCB07C780} = {4DA84F2B-1948-439B-85AB-E99E31331A9C}
{A8E2AB77-8F57-47C2-A961-2F316793CAFF} = {890B5210-48EF-488F-93A2-F13BCB07C780}
{F43CC5EA-6032-4A11-A9B2-6D48CB5EB082} = {4DA84F2B-1948-439B-85AB-E99E31331A9C}
{F057512B-55BF-4A8B-A027-A0505F8BA10C} = {4FDDC525-4E60-4CAF-83A3-261C5B43721F}
{10173568-A65E-44E5-8C6F-4AA49D0577A1} = {F057512B-55BF-4A8B-A027-A0505F8BA10C}
{97C7D2A4-87E5-4A4A-A170-D736427D5C21} = {F057512B-55BF-4A8B-A027-A0505F8BA10C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E8720B3-DBDD-498C-B383-2CC32A054E8F}
Expand Down
1 change: 1 addition & 0 deletions eng/ProjectReferences.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.IIS" ProjectPath="$(RepoRoot)src\Servers\IIS\IIS\src\Microsoft.AspNetCore.Server.IIS.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Core" ProjectPath="$(RepoRoot)src\Servers\Kestrel\Core\src\Microsoft.AspNetCore.Server.Kestrel.Core.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel" ProjectPath="$(RepoRoot)src\Servers\Kestrel\Kestrel\src\Microsoft.AspNetCore.Server.Kestrel.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes" ProjectPath="$(RepoRoot)src\Servers\Kestrel\Transport.NamedPipes\src\Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Quic" ProjectPath="$(RepoRoot)src\Servers\Kestrel\Transport.Quic\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" ProjectPath="$(RepoRoot)src\Servers\Kestrel\Transport.Sockets\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj" />
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Authentication.Certificate" ProjectPath="$(RepoRoot)src\Security\Authentication\Certificate\src\Microsoft.AspNetCore.Authentication.Certificate.csproj" />
Expand Down
1 change: 1 addition & 0 deletions eng/SharedFramework.Local.props
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Server.IIS" />
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" />
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Server.Kestrel" />
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes" />
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Quic" />
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" />
<AspNetCoreAppReference Include="Microsoft.AspNetCore.Authentication.Cookies" />
Expand Down
1 change: 1 addition & 0 deletions eng/TrimmableProjects.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<TrimmableProject Include="Microsoft.AspNetCore.Server.IIS" />
<TrimmableProject Include="Microsoft.AspNetCore.Server.Kestrel.Core" />
<TrimmableProject Include="Microsoft.AspNetCore.Server.Kestrel" />
<TrimmableProject Include="Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes" />
<TrimmableProject Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Quic" />
<TrimmableProject Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" />
<TrimmableProject Include="Microsoft.AspNetCore.Authentication.Certificate" />
Expand Down
2 changes: 2 additions & 0 deletions src/Framework/test/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ static TestData()
"Microsoft.AspNetCore.Server.Kestrel",
"Microsoft.AspNetCore.Server.Kestrel.Core",
"Microsoft.AspNetCore.Server.Kestrel.Transport.Quic",
"Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes",
"Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets",
"Microsoft.AspNetCore.Session",
"Microsoft.AspNetCore.SignalR",
Expand Down Expand Up @@ -228,6 +229,7 @@ static TestData()
{ "Microsoft.AspNetCore.Server.Kestrel.Core" },
{ "Microsoft.AspNetCore.Server.Kestrel.Transport.Quic" },
{ "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" },
{ "Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes" },
{ "Microsoft.AspNetCore.Server.Kestrel" },
{ "Microsoft.AspNetCore.Session" },
{ "Microsoft.AspNetCore.SignalR.Common" },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.IO.Pipes;

namespace Microsoft.AspNetCore.Connections.Features;

/// <summary>
/// Provides access to the connection's underlying <see cref="NamedPipeServerStream"/>.
/// </summary>
public interface IConnectionNamedPipeFeature
{
/// <summary>
/// Gets the underlying <see cref="NamedPipeServerStream"/>.
/// </summary>
NamedPipeServerStream NamedPipe { get; }
}
64 changes: 64 additions & 0 deletions src/Servers/Connections.Abstractions/src/NamedPipeEndPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Net;

namespace Microsoft.AspNetCore.Connections;

/// <summary>
/// Represents a Named Pipe endpoint.
/// </summary>
public sealed class NamedPipeEndPoint : EndPoint
{
internal const string LocalComputerServerName = ".";

/// <summary>
/// Initializes a new instance of the <see cref="NamedPipeEndPoint"/> class.
/// </summary>
/// <param name="pipeName">The name of the pipe.</param>
public NamedPipeEndPoint(string pipeName) : this(pipeName, LocalComputerServerName)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="NamedPipeEndPoint"/> class.
/// </summary>
/// <param name="pipeName">The name of the pipe.</param>
/// <param name="serverName">The name of the remote computer to connect to, or "." to specify the local computer.</param>
public NamedPipeEndPoint(string pipeName, string serverName)
{
ServerName = serverName;
PipeName = pipeName;
}

/// <summary>
/// Gets the name of the remote computer. The server name must be ".", the local computer, when creating a server.
/// </summary>
public string ServerName { get; }

/// <summary>
/// Gets the name of the pipe.
/// </summary>
public string PipeName { get; }

/// <summary>
/// Gets the pipe name represented by this <see cref="NamedPipeEndPoint"/> instance.
/// </summary>
public override string ToString()
{
return $"pipe:{ServerName}/{PipeName}";
}

/// <inheritdoc/>
public override bool Equals([NotNullWhen(true)] object? obj)
{
return obj is NamedPipeEndPoint other && other.ServerName == ServerName && other.PipeName == PipeName;
}

/// <inheritdoc/>
public override int GetHashCode()
{
return ServerName.GetHashCode() ^ PipeName.GetHashCode();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#nullable enable
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature.OnClosed(System.Action<object?>! callback, object? state) -> void
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
#nullable enable
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature.OnClosed(System.Action<object?>! callback, object? state) -> void
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
Microsoft.AspNetCore.Connections.TlsConnectionCallbackContext
Microsoft.AspNetCore.Connections.TlsConnectionCallbackContext.ClientHelloInfo.get -> System.Net.Security.SslClientHelloInfo
Microsoft.AspNetCore.Connections.TlsConnectionCallbackContext.ClientHelloInfo.set -> void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#nullable enable
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature.OnClosed(System.Action<object?>! callback, object? state) -> void
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#nullable enable
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature
Microsoft.AspNetCore.Connections.Features.IConnectionNamedPipeFeature.NamedPipe.get -> System.IO.Pipes.NamedPipeServerStream!
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature
Microsoft.AspNetCore.Connections.Features.IStreamClosedFeature.OnClosed(System.Action<object?>! callback, object? state) -> void
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector
Microsoft.AspNetCore.Connections.IConnectionListenerFactorySelector.CanBind(System.Net.EndPoint! endpoint) -> bool
Microsoft.AspNetCore.Connections.NamedPipeEndPoint
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.NamedPipeEndPoint(string! pipeName, string! serverName) -> void
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.PipeName.get -> string!
Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ServerName.get -> string!
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.Equals(object? obj) -> bool
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.GetHashCode() -> int
override Microsoft.AspNetCore.Connections.NamedPipeEndPoint.ToString() -> string!
5 changes: 0 additions & 5 deletions src/Servers/Kestrel/Core/src/Internal/KestrelServerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ public KestrelServerImpl(
}

// For testing
internal KestrelServerImpl(IConnectionListenerFactory transportFactory, ServiceContext serviceContext)
: this(new[] { transportFactory }, Array.Empty<IMultiplexedConnectionListenerFactory>(), serviceContext)
{
}

// For testing
internal KestrelServerImpl(
IEnumerable<IConnectionListenerFactory> transportFactories,
IEnumerable<IMultiplexedConnectionListenerFactory> multiplexedFactories,
Expand Down
34 changes: 29 additions & 5 deletions src/Servers/Kestrel/Core/src/KestrelServerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using System.Text.Json;
using Microsoft.AspNetCore.Certificates.Generation;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal;
using Microsoft.AspNetCore.Server.Kestrel.Https;
Expand Down Expand Up @@ -364,15 +365,15 @@ public KestrelConfigurationLoader Configure(IConfiguration config, bool reloadOn
}

/// <summary>
/// Bind to given IP address and port.
/// Bind to the given IP address and port.
/// </summary>
public void Listen(IPAddress address, int port)
{
Listen(address, port, _ => { });
}

/// <summary>
/// Bind to given IP address and port.
/// Bind to the given IP address and port.
/// The callback configures endpoint-specific settings.
/// </summary>
public void Listen(IPAddress address, int port, Action<ListenOptions> configure)
Expand Down Expand Up @@ -400,7 +401,7 @@ public void Listen(EndPoint endPoint)
}

/// <summary>
/// Bind to given IP address and port.
/// Bind to the given IP address and port.
/// The callback configures endpoint-specific settings.
/// </summary>
public void Listen(IPEndPoint endPoint, Action<ListenOptions> configure)
Expand Down Expand Up @@ -462,15 +463,15 @@ public void ListenAnyIP(int port, Action<ListenOptions> configure)
}

/// <summary>
/// Bind to given Unix domain socket path.
/// Bind to the given Unix domain socket path.
/// </summary>
public void ListenUnixSocket(string socketPath)
{
ListenUnixSocket(socketPath, _ => { });
}

/// <summary>
/// Bind to given Unix domain socket path.
/// Bind to the given Unix domain socket path.
/// Specify callback to configure endpoint-specific settings.
/// </summary>
public void ListenUnixSocket(string socketPath, Action<ListenOptions> configure)
Expand Down Expand Up @@ -510,4 +511,27 @@ public void ListenHandle(ulong handle, Action<ListenOptions> configure)
configure(listenOptions);
CodeBackedListenOptions.Add(listenOptions);
}

/// <summary>
/// Bind to the given named pipe.
/// </summary>
public void ListenNamedPipe(string pipeName)
{
ListenNamedPipe(pipeName, _ => { });
}

/// <summary>
/// Bind to the given named pipe.
/// Specify callback to configure endpoint-specific settings.
/// </summary>
public void ListenNamedPipe(string pipeName, Action<ListenOptions> configure)
{
ArgumentNullException.ThrowIfNull(pipeName);
ArgumentNullException.ThrowIfNull(configure);

var listenOptions = new ListenOptions(new NamedPipeEndPoint(pipeName));
ApplyEndpointDefaults(listenOptions);
configure(listenOptions);
CodeBackedListenOptions.Add(listenOptions);
}
}
Loading

0 comments on commit ee10898

Please sign in to comment.