blob: 31ef3cffc0aa0bbbecd56c5d2cbe94add84cfd42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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();
}
}
|