Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to use SSL secure sockets

The following example code demonstrates how to use secure sockets.

            ...

   // Connect the socket server
            User::LeaveIfError(iSocketServ.Connect());
            // Open the socket
         User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp)); 
            //Connect the socket
            connectInetAddr.SetAddress(KTestAddress);
            connectInetAddr.SetPort(KSSLPort);  //TLS port

            iSocket.Connect(connectInetAddr, iStatus); 

            ...

    
            // Construct the Tls socket
            iTlsSocket = CSecureSocket::NewL(iSocket, KSSLProtocol());
    // start the handshake 
           iTlsSocket->StartClientHandshake(iStatus);
            

[Top]


Sending and receiving data

Use CSecureSocket::Recv() and CSecureSocket::RecvOneOrMore() to receive data from the socket.

Use CSecureSocket::Send() to send data over the socket.