共用方式為


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

備註

大部分用於客戶端-伺服器驗證的安全性通訊協定會根據您是用戶端或伺服器,定義提供驗證認證的特定行為和需求。

適用於