Converts an (insecure) TCP connection with a remote server into a secure TLS-over-TCP connection.
It may be called after both of the following:
- a TCP socket has been created by the socket function, with u8Config parameter set to SOCKET_CONFIG_SSL_DELAY.
- a successful connection has been made on the socket via the connect function. This is an asynchronous API; the application socket callback function is notified of the result of the attempt to make the connection secure through the event SOCKET_MSG_SECURE, along with a structure tstrSocketConnectMsg. If the attempt to make the connection secure fails, the application should call close().
- Parameters
-
[in] | sock | Socket ID, corresponding to a connected TCP socket. |
- Precondition
- socket and connect must be called to connect a TCP socket before passing the socket ID to this function. Value SOCKET_CONFIG_SSL_DELAY must have been set in the u8Config parameter that was passed to socket.
- See Also
- socket connect
- Returns
- The function returns SOCK_ERR_NO_ERROR for successful operations and a negative error value otherwise. The possible error values are:
References MAX_SOCKET, NULL, tstrConnectCmd::sock, SOCK_ERR_INVALID, SOCK_ERR_INVALID_ARG, SOCK_ERR_NO_ERROR, SOCKET_CMD_SECURE, SOCKET_REQUEST, SSL_FLAGS_ACTIVE, SSL_FLAGS_DELAY, tstrSocket::u16SessionID, tstrConnectCmd::u16SessionID, tstrSocket::u8SSLFlags, and tstrConnectCmd::u8SslFlags.