Hi I need your help on SSL_shutdown(). . The Client send "close notify" to server first to initiates the close connection. This first call return 0 , which it is correctly. Then The Client call SSL_shutdown again to wait for "close notify" form Server. The second SSL_shutdown call RETURN 0 , INSTEAD OF 1. I DO KNOW WHY??. PLEASE HELP.
The following Close() function to handle SSL_shutdown(). The client send out 5 messages, then call Close() function. The Server 's SSL_read return SSL_ERROR_ZERO_RETURN, then call Close(). The Server behaves correctly. AT Client side: . Call 1 to set socket to blocking. . Call 2, return err == 0 which it is right. ( send close notify). . Call 3 . Call 4 (waiting for close notify from Server) with RETURN 0 INSTEAD OF 1. why ??? At Server side: . Call 1 to set socket to blocking. . Call 2, return err== 1, complete shutdown . Jump to 8 which it is supposed to be. . Close() { 1.setSocketToBlocking() 2. int err = SSL_shutdown() 3. If (err == 0) // not complete yet 4. { err = SSL_shutdown() 5. if (err == 1) // complete shutdown 6. { --close all..; } else { cout << "Error" << endl; } 7. } 8. else if (err== 1) 9. { --close all..; } else if ( err < 0) { cout << "ERROR.." << endl; } } } Thank You. TD