PrevNextUpHome SophiaFramework UNIVERSE 5.3

18.5. SFXSSLSocket Class

In the SSL Socket communication using the SFXSSLSocket class, data can be sent or received through the streams in the same way as the TCP Socket communication, except one more addition procedure, negotiation, is needed after the connection is established.

Reference: Network: SSL Socket Communication

In the code below, only the difference from the TCP Socket communication is shown.

Example 18.5. SSL Socket communication through the stream

// callback function notified of the connection result
XALLBACK_IMPLEMENT_SFXSSLSOCKET(MyClass, OnConnect, error)
{
    // register callback function (negotiation completion will be notified to OnNegotiate function)
    _socket.Negotiate(XALLBACK_INTERNAL(OnNegotiate));
}

// callback function notified of negotiation completion
XALLBACK_IMPLEMENT_SFXSSLSOCKET(MyClass, OnNegotiate, error)
{
    if (error == SFERR_NO_ERROR) {  

        // get streams to receive and send data through them
        ...

    } else { 

        // if an error occurs
        ...
    }
}