I would have phrased my last post differently but I was expecting the response 
to be part of an existing thread.  I was responding to the following 
statement/post:

Tony Yat-Tung Cheung wrote:
> Jason Freund wrote:
> 
>> The only way I could get the Ssl routines to communicate at all with
>> my server was to set the netSocketOptSockNonBlocking _after_ the
>> SslOpen handshake, and keep it set thereafter. Any other changes to
>> that flag in the socket would cause the Ssl commands to simply hang.
>>
>> But with that socket option set, SslOpen succeeds, it proceeds to do
>> an SslSend to send a POST command, and then does an SslRead, which
>> seems to read the complete server response, but also sets the
>> SslContext error to netErrWouldBlock, killing the conversation.
>> Setting the Context's ReadStreaming or not doesn't affect the
>> outcome.
>>

The bottom line is this.  I work for a company called Phantom Fiber Inc. that 
has had a great deal of success using the standard netLib non-blocking 
functionality with its production Palm applications. We find this non-blocking 
feature frankly crutial given that the Palm is single threaded.

Now that PalmOS 5.2 supports SSL natively, I was hoping (somewhat naively) to 
implement a similar non-blocking SSL implementation.  What I'm finding, 
however, is that SslOpen() and SslClose() functions don't like non-blocking 
sockets.  I'm guessing because whoever implemented the handshake and 
goodbye-kiss of the SSL layer was a little lazy and didn't want to code those 
methods to properly maintain state in the event that the underlying socket 
returned netErrWouldBlock.

There have been suggestions that perhaps the non-blocking could be turned off 
for the duration of SslOpen() and SslClose(), but I've found that solution to 
be unstable.  It sometimes works but eventually leads to problems.  In my case, 
the SslClose() method continually returns netErrWouldBlock even though the 
non-blocking IO has been turned off.

Has anyone successfully implemented SSL communication using the non-blocking 
sockets feature?  If so, I'd love to hear how.

Colin


-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to