• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Non-blocking SSLWrite problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-blocking SSLWrite problems


  • Subject: Re: Non-blocking SSLWrite problems
  • From: Rich Siegel <email@hidden>
  • Date: Wed, 12 Oct 2005 13:12:11 -0400

On 10/12/05 at 11:35 AM, Brian Webster <email@hidden> wrote:

> The problem is that the value I'm getting back from the last argument
> to SSLWrite, which passes back the number of bytes successfully
> written to the stream, always returns the full number of bytes that
> were given to SSLWrite, despite the fact that not all those bytes
> were actually written to the socket.

Oh, and one other thing: I'm pretty sure that SSLWrite() returns
errSSLWouldBlock if the SSL stack determines that it can't write as much
data as you asked it to, in which case you ask it to send the data that
didn't get sent on the first attempt. Thus:

    OSStatus    status = noErr;
    const UInt8 *p = reinterpret_cast<const UInt8*>(data);
    SInt32      bytesRemaining = length;

    while (bytesRemaining > 0)
    {
        size_t  actLen = 0;

        status = SSLWrite(fSSLContext, data, bytesRemaining, &actLen);
        verify_noerr(status);

        bytesRemaining -= actLen;
        p += actLen;

        if (errSSLWouldBlock == status)
            continue;

        FailOSStatus(status);
    }

Hope this helps,

R.
--
Rich Siegel                                 Bare Bones Software, Inc.
<email@hidden>                      <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Non-blocking SSLWrite problems (From: Brian Webster <email@hidden>)

  • Prev by Date: Re: Non-blocking SSLWrite problems
  • Next by Date: Re: Non-blocking SSLWrite problems
  • Previous by thread: Re: Non-blocking SSLWrite problems
  • Next by thread: Re: Non-blocking SSLWrite problems
  • Index(es):
    • Date
    • Thread