diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-E3E19113-AAEE-55C2-8016-11D492123762.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-E3E19113-AAEE-55C2-8016-11D492123762.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,53 @@ + + + + + +Creating a new sub-connection - Adding an already connected socket

The following example shows how an application can use a sub-connection explicitly via an RSubConnection instance, and tie an already connected RSocket to the sub-connection that has had its properties set (parameter creation is described in separate section):

RSocketServ ss; +RConnection conn; +RSubConnection subconn; +RSocket sock; +TRequestStatus status; + +// Connect to ESOCK +ss.Connect(); + +// Open an Connection +conn.Open(ss, KAfInet); + +// Start the connection +conn.Start(status); +User::WaitForRequest(status); + +// Open a TCP socket on the connection +sock.Open(ss, KAfInet, KSockStream, KProtocolInetTcp, conn); + +_LIT(KRasAddr,"10.159.24.13"); +const TInt KEchoPort = 7; + +TInetAddr destAddr; +destAddr.Input(KRasAddr); +destAddr.SetPort(KEchoPort); + +// Connect the Socket to the destination over the connection (default sub-connection) +sock.Connect(destAddr, status); + +// Create a new sub-connection +subconn.Open(ss, RSubConnection::ECreateNew, conn); + +// Set Properties of the sub-connection +subconn.SetParameters(…); + +// Move the connected socket onto the new sub-connection +TRequestStatus status; +subconn.Add(sock, status); + +// Wait for socket to added +User::WaitForRequest(status); +

Note: Error handling is not included to aid clarity.

\ No newline at end of file