Bagikan melalui


SslStream.IsServer Properti

Definisi

Boolean Mendapatkan nilai yang menunjukkan apakah sisi lokal koneksi yang digunakan oleh ini SslStream diautentikasi sebagai server.

public:
 virtual property bool IsServer { bool get(); };
public override bool IsServer { get; }
member this.IsServer : bool
Public Overrides ReadOnly Property IsServer As Boolean

Nilai Properti

true jika titik akhir lokal berhasil diautentikasi sebagai sisi server dari koneksi yang diautentikasi; jika tidak false.

Contoh

Contoh kode berikut menunjukkan menampilkan nilai properti ini.

static void DisplaySecurityServices( SslStream^ stream )
{
   Console::WriteLine( L"Is authenticated: {0} as server? {1}", stream->IsAuthenticated, stream->IsServer );
   Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
   Console::WriteLine( L"Is Encrypted: {0}", stream->IsEncrypted );
   Console::WriteLine( L"Is mutually authenticated: {0}", stream->IsMutuallyAuthenticated );
}
static void DisplaySecurityServices(SslStream stream)
{
   Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer);
   Console.WriteLine("IsSigned: {0}", stream.IsSigned);
   Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted);
   Console.WriteLine("Is mutually authenticated: {0}", stream.IsMutuallyAuthenticated);
}
Private Shared Sub DisplaySecurityServices(stream As SslStream)
    Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer)
    Console.WriteLine("IsSigned: {0}", stream.IsSigned)
    Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted)
    Console.WriteLine("Is mutually authenticated: {0}", stream.IsMutuallyAuthenticated)
End Sub

Keterangan

Jika autentikasi gagal atau tidak terjadi, properti ini mengembalikan false.

Untuk mengautentikasi sebagai server, panggil AuthenticateAsServer metode atau BeginAuthenticateAsServer .

Berlaku untuk