NetworkStream/SslStream EndWrite problem.

  • Thread starter Thread starter Andre Azevedo
  • Start date Start date
A

Andre Azevedo

Hi all,

I'm writing an async socket server using Networkstream and SslStream.
Using the Socket class, the EndSend method returns the bytes writed and you
can loop until all bytes are sended. But if you using any stream (Network or
Ssl) the EndWrite method doesn't return nothing.

I can solve this problem using the Socket class if I don't need to use Ssl.
But, if I need to use it, how do I know if all bytes were sended using
EndWrite?

TIA,
 
The EndWrite will not be called until the number of bytes sent is what you
sent in BeginWrite (or exception happens). So if your in the callback and
EndWrite does not throw exception, then your bytes where sent. If you need
the bytes sent, add that to your state object.

--
William Stacey [MVP]

| Hi all,
|
| I'm writing an async socket server using Networkstream and SslStream.
| Using the Socket class, the EndSend method returns the bytes writed and
you
| can loop until all bytes are sended. But if you using any stream (Network
or
| Ssl) the EndWrite method doesn't return nothing.
|
| I can solve this problem using the Socket class if I don't need to use
Ssl.
| But, if I need to use it, how do I know if all bytes were sended using
| EndWrite?
|
| TIA,
|
| --
| Andre Azevedo
|
|
 
Back
Top