NegotiateStream コンストラクタ (Stream, Boolean)
アセンブリ: System (system.dll 内)

Dim innerStream As Stream Dim leaveInnerStreamOpen As Boolean Dim instance As New NegotiateStream(innerStream, leaveInnerStreamOpen)


leaveStreamOpen パラメータに true を指定すると、NegotiateStream を閉じても innerStream ストリームには影響しません。innerStream が不要になった場合は、明示的に閉じる必要があります。

このコンストラクタを実際に呼び出すコード例を次に示します。このコード例は、NegotiateStream クラスのトピックで取り上げているコード例の一部分です。
// Establish the remote endpoint for the socket. // For this example, use the local machine. IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost"); IPAddress ipAddress = ipHostInfo.AddressList[0]; // Client and server use port 11000. IPEndPoint remoteEP = new IPEndPoint(ipAddress, 11000); // Create a TCP/IP socket. client = new TcpClient(); // Connect the socket to the remote endpoint. client.Connect(remoteEP); Console.WriteLine("Client connected to {0}.", remoteEP.ToString()); // Ensure the client does not close when there is // still data to be sent to the server. client.LingerState = (new LingerOption(true, 0)); // Request authentication. NetworkStream clientStream = client.GetStream(); NegotiateStream authStream = new NegotiateStream(clientStream, false);

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


NegotiateStream コンストラクタ
ユーザーが指定するストリームを NegotiateStream が閉じないようにするには、NegotiateStream(Stream,Boolean) コンストラクタを使用します。

名前 | 説明 |
---|---|
NegotiateStream (Stream) | Stream を指定して、NegotiateStream クラスの新しいインスタンスを初期化します。 |
NegotiateStream (Stream, Boolean) | 指定した Stream とストリームを閉じる動作を使用して、NegotiateStream クラスの新しいインスタンスを初期化します。 |

NegotiateStream コンストラクタ (Stream)
アセンブリ: System (system.dll 内)


// Establish the remote endpoint for the socket. // For this example, use the local machine. IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; // Client and server use port 11000. IPEndPoint remoteEP = new IPEndPoint(ipAddress,11000); // Create a TCP/IP socket. TcpClient client = new TcpClient(); // Connect the socket to the remote endpoint. client.Connect(remoteEP); Console.WriteLine("Client connected to {0}.", remoteEP.ToString()); // Ensure the client does not close when there is // still data to be sent to the server. client.LingerState = (new LingerOption(true ,0)); // Request authentication. NetworkStream clientStream = client.GetStream(); NegotiateStream authStream = new NegotiateStream(clientStream); // Request authentication for the client only (no mutual authentication). // Authenicate using the client's default credetials. // Permit the server to impersonate the client to access resources on the server only. // Request that data be transmitted using encryption and data signing. authStream.AuthenticateAsClient( (NetworkCredential) CredentialCache.DefaultCredentials, "", ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Impersonation);

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- NegotiateStream コンストラクタのページへのリンク