diff -r 80ef3a206772 -r 48780e181b38 Symbian3/SDK/Source/GUID-F389671B-FC30-561B-BF48-E597D0CB2D47.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-F389671B-FC30-561B-BF48-E597D0CB2D47.dita Tue Jul 20 12:00:49 2010 +0100 @@ -0,0 +1,55 @@ + + + + + +Using +Secure Sockets : TutorialThis topic describes how to use secure sockets. + +Open a socket using +RSocket::Open() function and connect it with RSocket::Connect() function. + + +Create a secure socket by calling CSecureSocket::NewL() function with +the parameters as socket and secure protocol name. + + +To start the application acting as a client, use the CSecureSocket::StartClientHandshake() +function to initiate a handshake with the remote server. To start the application +acting as a server, use the CSecureSocket::StartServerHandshake() function. +The call completes with an error code, if the handshake fails. + + +Secure Sockets example

In the following example +iSocket is a reference to the already opened and connected socket and KSSLProtocol +is the descriptor containing the name of a protocol, in this case TLS1.0. +The function should return a pointer to the CSecureSocket.

+// 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); + +
+

Use CSecureSocket::Send() to send data over the socket. Use CSecureSocket::Recv() +and CSecureSocket::RecvOneOrMore() to receive data from the socket.

+
\ No newline at end of file