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
//1 Builds a vector of secure socket attributes to wait for. An ordered vector Essential Tools Module class represents the list of attributes.
//2 Adds the conditions to the list. In this case, the application is waiting for either s1 or s2 to be ready for reading.
//3 Waits for at least one condition to be true. The conditions are passed in as an RWTValOrderedVector<RWSecureSocketAttribute>, a vector of secure socket attributes. If one of the conditions in waiton is already true, rwSecureSocketSelect() returns immediately. You can pass an optional second argument to set a timeout in seconds. The function returns a list of conditions that are true.
NOTE: The SourcePro API Reference Guide describes rwSecureSocketSelect() on the Secure Sockets page, accessible from the Modules tab.