Hello all,
I am developing a client that should open 3 sockets to the same address/port and communicate with our server using TLS. I am using CFStream.
Everything works ok for first socket, but when I am trying to open second socket, the SSL handshake fails.
I see in sniffer, that when I am opening the first socket, it sends the ClientHello packet. The sessionID is empty.
But when I am opening the second socket and sending ClientHello, the sessionID contains the 32-bytes token, sent by server in ServerHello to the first socket. So it behaves like it wants to re-negotiate.
I have read about TLS Session Cache (see QA1727
https://developer.apple.com/library/ios/qa/qa1727/_index.html
), that “A TLS connection can either establish a new session or it can attempt to resume an existing session, where resuming an existing session is much cheaper than starting a new one.”
Can it be my case? I.e. when I am trying to open the second socket, CFNetwork uses the existing TLS session?
If yes, if I can avoid it, and make the second socket to connect “from scratch”? (It can make me a problem during connection).
Or it is relevant only for NSURLConnection?
If there any other problems, that can occur when I am connecting to the same IP address / port simultaneously?
Thanks a lot,
Yulia