diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-3AB8E95D-4270-5CDE-994E-404BCBEC57B6.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-3AB8E95D-4270-5CDE-994E-404BCBEC57B6.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,46 @@ + + + + + + Attaching to the default sub-connection: Tutorial

This tutorial describes how an application can use the RSubConnection API to attach to the default sub-connection.

In the following example, the application wants to connect to the default sub-connection to set its properties. The application simply tries to connect a socket over the connection (which uses the default sub-connection) after it has set properties on the default sub-connection. An example of parameter creation can be found in the separate tutorial Creating and setting properties for a Sub-Connection.

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); + +// Attach to the default sub-connection +subconn.Open(ss, RSubConnection::EAttachToDefault, conn); + +// Set Properties of the default sub-connection +subconn.SetParameters(…); + +// Open a TCP socket on the connection (this is the same as using the default sub-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); + +// Request the Socket to connect to the destination over the default sub-connection +sock.Connect(destAddr, status); +

Note: Error handling is not included to aid clarity.

\ No newline at end of file