NegotiateStream.Write メソッド
アセンブリ: System (system.dll 内)

Dim instance As NegotiateStream Dim buffer As Byte() Dim offset As Integer Dim count As Integer instance.Write(buffer, offset, count)


暗号化、署名、または暗号化と署名が有効になっている場合、このメソッドが、バッファからのデータの読み込み、読み込んだデータの暗号化、署名、または暗号化と署名、および基になるストリームを使用したデータの送信を行います。データの暗号化や署名などのセキュリティ サービスが使用されていない場合、このメソッドは基になるストリームで M:Write を呼び出します。
このメソッドは、書き込み操作の実行中にブロックします。操作が完了するまでブロックしないようにするには、Write メソッドを使用します。
このメソッドは、正常に認証されるまで呼び出すことはできません。認証するには、AuthenticateAsClient、BeginAuthenticateAsClient、AuthenticateAsServer、または BeginAuthenticateAsServer のいずれかのメソッドを呼び出します。
NegotiateStream クラスは、複数の書き込み操作の同時実行をサポートしていません。同じストリームで既に書き込み操作が実行中であるときに、別の書き込み操作を開始しようとすると、NotSupportedException 例外がスローされます。

NegotiateStream に書き込みを行うコード例を次に示します。
public static void Main(String[] args) { // 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); DisplayAuthenticationProperties(authStream); DisplayStreamProperties(authStream); if (authStream.CanWrite) { // Encode the test data into a byte array. byte[] message = System.Text.Encoding.UTF8.GetBytes("Hello from the client."); authStream.Write(message, 0, message.Length); authStream.Flush(); Console.WriteLine("Sent {0} bytes.", message.Length); } // Close the client connection. authStream.Close(); Console.WriteLine("Client closed."); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からNegotiateStream.Write メソッドを検索する場合は、下記のリンクをクリックしてください。

- NegotiateStream.Write メソッドのページへのリンク