[Mono-dev] System.Web.Mail and TLS
Vladimir Krasnov
vladimirk at mainsoft.com
Wed Mar 29 09:40:52 EST 2006
Hi Gonzalo,
What if the response from SMTP server is multi-line? For example, SMTP
from IIS 6.0 returns multi-line response on EHLO command.
Vladimir Krasnov
-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Gonzalo
Paniagua Javier
Sent: Tuesday, March 28, 2006 5:09 AM
To: mono-devel-list at lists.ximian.com
Subject: RE: [Mono-dev] System.Web.Mail and TLS
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.
-Gonzalo
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list