Re: Non-blocking SSLWrite problems
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