[Mono-dev] System.Web.Mail and TLS

Gonzalo Paniagua Javier gonzalo at ximian.com
Mon Mar 27 22:09:02 EST 2006

On Mon, 2006-03-27 at 02:20 -0800, Vladimir Krasnov wrote:
> Hi Gonzalo,
> What do you suggest about ReadResponse? Mono SslClientStream does not
> inherit from NetworkStream, so how can I know if more data is available
> in the stream and calling Read() again cannot be used because it blocks
> if no data available.

You're reading the response from the server *line* by line. So I would
read, say, 4KB at a time and search for a \r\n$ or \n$ or \r$ ($ being
the end of line). You can safely read up to that without blocking
forever unless the server is misbehaving.

If the line does not fit in that byte [], you can use a MemoryStream to
buffer the input and keep reading until an EOL.


More information about the Mono-devel-list mailing list