Establishes a secure session. For CoAP Secure API do first: Set X509 Pk and Cert for use DTLS mode ECDHE ECDSA with AES 128 CCM 8 or set PreShared Key for use DTLS mode PSK with AES 128 CCM 8.
Records the remote host and port for this connection. By default TCP Fast Open is used. This means that this function merely records the remote host and port, and that the TCP connection establishment handshake only happens on the first call to otTcpSendByReference(). TCP Fast Open can be explicitly disabled using @p aFlags, in which case the TCP connection establishment handshake is initiated immediately. @sa otTcpConnect