(.NET 2) SSL Stream ans async write

Hello,

im using the new SSLStream class from the .NET framework version 2.0.
My stream is using async functions BeginRead and BeginWrite. When i send multiple packets very fast with multiple BeginWrite calls then i get the following exception:

"The BeginWrite method cannot be called when another write operation is
pending"

Is there smth i do wrong Shouldnt the stream itself take care about
pending packets and queue them
I never had problems before with normal unencrypted sockets in my apps.

Thanx Alex




Answer this question

(.NET 2) SSL Stream ans async write

  • _Nik_

    hm, CanWrite is always true. How can i know that the stream is in the pending state

    Alex


  • Hammad_Awan

    Do you have a workaround for this problem
    I think its very important for a network stream to support multiple async send operations. Thats the software design most applications are based on.
    So i think the only solution for now is to use the stream in synchronous mode for sending.

    Alex


  • blueinc

    ok, i got it working. if somebody is interested at the code you could checkout it here:
    https://thecave.myjabber.net/svn/ags/XMPP/agsxmpp/trunk/net/ClientSocket.cs

    Alex

  • Sossles

    I don't know the answer to your question. You would have to contact product support and make a formal request for the change in behavior.

  • jnouel

    yeah, Link is working...

    thanks


  • e3Di

    is there a way to know that a async send will fail
    Does CanWrite return false then

    Alex


  • ivannavi

    According to the developer that wrote the SSLStream class, this behavior is because SSLStream designed to work on any generic transport stream (not just a NetworkStream).  Not all streams support multiple async operations being issued and there is no way for the SSLStream class to know if the underlying stream supports it.  Due to this fact, it was decided to not allow this scenario at this time, but we will consider removing this restriction in a future release or service pack.

  • RaoulDukey

    No we don't have a work around.
    No you don't need to fallback on Sync
    You can simply issue the next send within the callback of the first send completion


  • Jeff DeLong

    Hi Jon,

    We are currently adding encryption to a socket server providing service to well over 500 concurrent socket connections, this really poses an issue for us, is there anyway we could push for a workaround hotfix other then the mentioned below which are not applicable for us.

    Thanks,

    Shai


  • Pieter van der Berg

    Alex

    links is not working, can you please provide me with valid link

    Thanks in advance


  • (.NET 2) SSL Stream ans async write