Namespace: dmSSLSocket
Language: C++
Type: Defold C++
File: sslsocket.h
Source: engine/dlib/src/dmsdk/dlib/sslsocket.h
Include: dmsdk/dlib/sslsocket.h
Secure socket functions.
Type: FUNCTION Delete a secure socket. Does not close the underlying socket
Parameters
socket (Socket) - Secure socket to closeReturns
result (Result) - RESULT_OK on successExamples
dmSSLSocket::Delete(sslsocket);
Type: FUNCTION Set socket receive timeout
Notes
Parameters
socket (Socket) - sockettimeout (uint64_t) - timeout in microsecondsReturns
result (dmSocket::Result) - RESULT_OK on successType: CONSTANT SSLSocket socket handle
Type: FUNCTION Create a new secure socket
Parameters
socket (dmSocket::Socket) - The socket to wraphost (const char*) - The name of the host (e.g. “httpbin.org”)timeout (uint64_t) - The timeout for the handshake procedure. (microseconds)sslsocket (Socket*) - Pointer to a secure socketReturns
result (Result) - RESULT_OK on successExamples
dmSSLSocket::Result result;
dmSSLSocket::Socket sslsocket;
result = dmSSLSocket::New(socket, "httpbin.org", 500*1000, &sslsocket);
if (dmSSLSocket::RESULT_OK == result)
{
// ...
} else {
// ...
}
Type: FUNCTION Receive data on a secure socket
Parameters
socket (Socket) - Socket to receive data onbuffer (void*) - Buffer to receive tolength (int) - Receive buffer lengthreceived_bytes (int*) - Number of received bytes (result)Returns
result (dmSocket::Result) - RESULT_OK on successType: ENUM Result enumeration.
Members
dmSSLSocket::RESULT_OK - (0)dmSSLSocket::RESULT_SSL_INIT_FAILED - (-2000)dmSSLSocket::RESULT_HANDSHAKE_FAILED - (-2001)dmSSLSocket::RESULT_WOULDBLOCK - (-2002)dmSSLSocket::RESULT_CONNREFUSED - (-2003)Type: FUNCTION Send a message on a secure socket
Parameters
socket (Socket) - SSL socket to send a message onbuffer (void*) - Buffer to sendlength (int) - Length of buffer to sendsent_bytes (int*) - Number of bytes sent (result)Returns
result (dmSocket::Result) - RESULT_OK on successType: TYPEDEF Socket type definition