SDK Secure socket API documentation

Version: stable

FUNCTION
dmSSLSocket::Delete()

delete a secure socket

dmSSLSocket::New()

create a secure socket

dmSSLSocket::Receive()

receive data on a secure socket

dmSSLSocket::Send()

send a message on a secure socket

dmSocket::SetReceiveTimeout()
ENUMS
dmSSLSocket::Result

result enumeration

Functions

dmSSLSocket::Delete()

dmSSLSocket::Delete(socket)

Delete a secure socket. Does not close the underlying socket

PARAMETERS

socket

dmSSLSocket::Socket Secure socket to close

RETURNS

RESULT_OK

on success

EXAMPLES

dmSSLSocket::Delete(sslsocket);

dmSSLSocket::New()

dmSSLSocket::New(socket,host,timeout,sslsocket)

Create a new secure socket

PARAMETERS

socket

dmSocket::Socket The socket to wrap

host

const char* The name of the host (e.g. "httpbin.org")

timeout

uint64_t The timeout for the handshake procedure. (microseconds)

sslsocket

dmSSLSocket::Socket* Pointer to a secure socket

RETURNS

RESULT_OK

on succcess

EXAMPLES

dmSSLSocket::Result result;
dmSSLSocket::Socket sslsocket;
result = dmSSLSocket::New(socket, "httpbin.org", 500*1000, &sslsocket);
if (dmSSLSocket::RESULT_OK == result)
{
    // ...
} else {
    // ...
}

dmSSLSocket::Receive()

dmSSLSocket::Receive(socket,buffer,length,received_bytes)

Receive data on a secure socket

PARAMETERS

socket

dmSSLSocket::Socket Socket to receive data on

buffer

Buffer to receive to

length

Receive buffer length

received_bytes

Number of received bytes (result)

RETURNS

RESULT_OK

on success


dmSSLSocket::Send()

dmSSLSocket::Send(socket,buffer,length,sent_bytes)

Send a message on a secure socket

PARAMETERS

socket

dmSSLSocket::Socket SSL socket to send a message on

buffer

Buffer to send

length

Length of buffer to send

sent_bytes

Number of bytes sent (result)

RETURNS

RESULT_OK

on success


dmSocket::SetReceiveTimeout()

dmSocket::SetReceiveTimeout(socket,timeout)

Set socket receive timeout

PARAMETERS

socket

dmSocket::Socket socket

timeout

uint64_t timeout in microseconds

RETURNS

RESULT_OK

on success


Enums

dmSSLSocket::Result

result enumeration

Result enumeration.

dmSSLSocket::RESULT_OK

(0)

dmSSLSocket::RESULT_SSL_INIT_FAILED

(-2000)

dmSSLSocket::RESULT_HANDSHAKE_FAILED

(-2001)

dmSSLSocket::RESULT_WOULDBLOCK

(-2002)

dmSSLSocket::RESULT_CONNREFUSED

(-2003)