[Mono-list] Re: SslClientStream: nonblocking read?
Carlos Guzmán Álvarez
carlosga@telefonica.net
Fri, 03 Dec 2004 17:31:48 +0100
Hello:
> If I understand correctly the source, then I pass "count" to the Read
> function and it will read as many SSL/TLS records as necessary to get
> count bytes before returning. In my situation, I would have to set
> count = 1 but this is horribly inefficient -- I would like to set
> count to max(1, input_buffer.Available).
>
Can you do a little test ?? Just modify the RecordProtocol.ReceiveRecord
method as:
public byte[] ReceiveRecord()
{
if (this.context.ConnectionEnd)
{
throw new TlsException(
AlertDescription.InternalError,
"The session is finished and it's no longer valid.");
}
// If the inner stream is a NetworkStream and there are no data
// return null
if (this.context.IsActual && this.innerStream is NetworkStream)
{
if (!((NetworkStream)this.innerStream).DataAvailable)
{
return null;
}
}
...
}
And let us now if that helps. If not, can you send a test case
reproducing the problem ??
--
Best regards
Carlos Guzmán Álvarez
Vigo-Spain
"In the end there can be only one" (Highlander)