Using rwSecureSocketSelect
You can use the global function
rwSecureSocketSelect() to test attributes and wait for them to become
true.
Example 9 shows how to wait on two secure sockets at the same time.
NOTE: The implementation of
rwSecureSocketSelect() operates on the TCP socket underlying the secure connection. Global function
rwSecureSocketSelect() uses the
select() system call. Since the SSL/TLS protocols are record oriented, it is possible to get into a situation where a “can read” attribute is true on a secure socket, but then the read may block to wait for the rest of the SSL record to be transmitted. See
SSL and TLS - Designing and Building Secure Systems, by Eric Rescorla, referenced in
Appendix B .
Example 9 – Using the global function rwSecureSocketSelect
// Establish two connected secure sockets, s1 and s2
RWTValOrderedVector<RWSecureSocketAttribute> waiton; //1
waiton.append(RWSecureSocketAttribute(
s1,RWSecureSocketAttribute::CANREAD)); //2
waiton.append(RWSecureSocketAttribute(
s2,RWSecureSocketAttribute::CANREAD));
RWTValOrderedVector<RWSecureSocketAttribute> ready =
rwSecureSocketSelect(waiton); //3
// Do something with the secure sockets that are ready