AuthenticatedStream.IsServer 属性

定义

获取一个 Boolean 值,该值指示连接的本地端是否已作为服务器经过了身份验证。

public:
 abstract property bool IsServer { bool get(); };
public abstract bool IsServer { get; }
member this.IsServer : bool
Public MustOverride ReadOnly Property IsServer As Boolean

属性值

如果本地终结点作为经过身份验证的客户端/服务器连接的服务器端进行了身份验证,则为 true;如果本地终结点作为客户端进行了身份验证,则为 false

示例

下面的示例演示如何显示此属性的值。

// The following class displays the properties of an authenticatedStream.
public ref class AuthenticatedStreamReporter
{
public:
   static void DisplayProperties( AuthenticatedStream^ stream )
   {
      Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated );
      Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated );
      Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted );
      Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
      Console::WriteLine( L"IsServer: {0}", stream->IsServer );
   }

};
// The following class displays the properties of an authenticatedStream.
public class AuthenticatedStreamReporter
{
    public static void DisplayProperties(AuthenticatedStream stream)
    {
        Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated);
        Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated);
        Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted);
        Console.WriteLine("IsSigned: {0}", stream.IsSigned);
        Console.WriteLine("IsServer: {0}", stream.IsServer);
    }
}
' The following class displays the properties of an AuthenticatedStream.
Public Class AuthenticatedStreamReporter
    Public Shared Sub DisplayProperties(stream As AuthenticatedStream)
        Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated)
        Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated)
        Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted)
        Console.WriteLine("IsSigned: {0}", stream.IsSigned)
        Console.WriteLine("IsServer: {0}", stream.IsServer)
    End Sub
End Class

注解

用于客户端-服务器身份验证的大多数安全协议根据你是客户端还是服务器,定义了提供身份验证凭据的特定行为和要求。

适用于