SslStream.Read メソッド
アセンブリ: System (system.dll 内)
構文Public Overrides Function Read ( _ buffer As Byte(), _ offset As Integer, _ count As Integer _ ) As Integer
Dim instance As SslStream Dim buffer As Byte() Dim offset As Integer Dim count As Integer Dim returnValue As Integer returnValue = instance.Read(buffer, offset, count)
戻り値
読み取るバイト数を指定する Int32 値。読み取るデータがこれ以上存在しない場合は 0 を返します。
例外
解説このメソッドは、count で指定した最大バイトをストリームから読み取り、buffer 内の offset で始まる位置に格納します。複数の読み取り操作を同時に実行することはできません。
このメソッドは、正常に認証されるまで呼び出すことはできません。認証するには、AuthenticateAsClient、BeginAuthenticateAsClient、AuthenticateAsServer、BeginAuthenticateAsServer のいずれかのメソッドを呼び出します。
使用例static string ReadMessage(SslStream sslStream) { // Read the message sent by the server. // The end of the message is signaled using the // "<EOF>" marker. byte [] buffer = new byte[2048]; StringBuilder messageData = new StringBuilder(); int bytes = -1; do { bytes = sslStream.Read(buffer, 0, buffer.Length); // Use Decoder class to convert from bytes to UTF8 // in case a character spans two buffers. Decoder decoder = Encoding.UTF8.GetDecoder(); char[] chars = new char[decoder.GetCharCount(buffer ,0,bytes)]; decoder.GetChars(buffer, 0, bytes, chars,0); messageData.Append (chars); // Check for EOF. if (messageData.ToString().IndexOf("<EOF>") != -1) { break; } } while (bytes != 0); return messageData.ToString(); }
プラットフォーム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に収録されているすべての辞書からSslStream.Read メソッドを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からSslStream.Read メソッド
を検索
- SslStream.Read メソッドのページへのリンク