Things to note before reading:
- This is using a plain old TCP socket not a HTTP request.
- Plain text traffic works without issue.
- Other platform builds using LibreSSL library also work without issue.
- Our iOS build using SSLHandshake fails about 80% of the time, other times works without issue.
During the times the call to SSLHandshake fails it exchanges the following bytes:
write:
151
read:
5, 89, 5, 2797
It seems like it gives up once it starts reading certificates back from the server. I am assuming thats what the 2797 chunk of bytes is. SSLHandshake then fails and returns with error code -50.
During the times the SSLHandshake call succeeds it exchanges the following bytes:
write:
151
read:
5, 89, 5, 5574, 5, 333, 5, 4
write:
75, 6, 45
read:
5, 1, 5, 40
Then the handshake succeeds and returns noErr. I cannot for the life of me figure out why it fails when it does and succeeds when it does. Any input would be greatly appreciated.