Modified to show better error message.
Implemented TLS server socket. (TLS 1.2 is not supported yet)