diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-3AB8E95D-4270-5CDE-994E-404BCBEC57B6.dita --- a/Symbian3/PDK/Source/GUID-3AB8E95D-4270-5CDE-994E-404BCBEC57B6.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-3AB8E95D-4270-5CDE-994E-404BCBEC57B6.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,46 +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); + + + + + + 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