Symbian3/SDK/Source/GUID-7FD49142-23DC-44FC-BA7D-C11E0559C8CF.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 12:39:03 +0100
changeset 8 ae94777fff8f
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-7FD49142-23DC-44FC-BA7D-C11E0559C8CF" xml:lang="en"><title>Opening
a Connection to a SNAP by specifying SNAP ID</title><shortdesc>Extended Connection Preferences API can be used by applications
to set the SNAP ID prior to establishing a connection.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context id="GUID-BC67F7E5-DAC2-4B2D-B9FE-C55CA4DBF845">       <p>Specifying
SNAP ID enables the applications to start a connection to a specific SNAP.</p> 
  </context>
<steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-10-1-14-1-1-4-1-1-5-1-1-4-1-3-2">
<step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-10-1-14-1-1-4-1-1-5-1-1-4-1-3-2-1"><cmd>Connect to <xref href="GUID-1277D793-4A0A-50A7-9414-AEE93E906E80.dita"> socket server </xref>.</cmd>
<info> <codeblock xml:space="preserve">RSocketServ ss;
ss.Connect();       </codeblock>                  </info>
</step>
<step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-10-1-14-1-1-4-1-1-5-1-1-4-1-3-2-2"><cmd> Open a <xref href="GUID-BD8446C5-3ADE-59A6-A13A-A5482D6FC56F.dita"> RConnection </xref> object.</cmd>
<info> <codeblock xml:space="preserve">RConnection conn;
conn.Open( ss );</codeblock>                 </info>
</step>
<step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-10-1-14-1-1-4-1-1-5-1-1-4-1-3-2-3"><cmd>Create a connection
preference list and extended connection preferences object.</cmd>
<info> <codeblock xml:space="preserve">TConnPrefList prefList;
TExtendedConnPref preferences;    </codeblock>                  </info>
</step>
<step id="GUID-0638ECC7-4D10-48EB-A0E3-45225761DDD4"><cmd>Set the SNAP ID
using <xref href="GUID-B78E8AC0-CDC8-3DEC-AF3C-98C8994DA34A.dita#GUID-B78E8AC0-CDC8-3DEC-AF3C-98C8994DA34A/GUID-A7AD4DBA-35C6-3743-BC88-BE19ABC93036"><apiname>TExtendedConnPref::SetSnapId()</apiname></xref>.</cmd>
<info><codeblock xml:space="preserve">preference.SetSnapId( 4 );</codeblock></info>
</step>
<step id="GUID-71C73AC8-81AD-4D13-889A-84FB3E99618F"><cmd>Append the extended
connection preferences to connection preference list. </cmd>
<info><codeblock xml:space="preserve">prefList.AppendL( &amp;preferences );</codeblock></info>
</step>
<step id="GUID-EF50B49C-E10A-427A-8BA4-C0ABDDF4DCC4"><cmd>	Start a connection
with connection preferences.</cmd>
<info><codeblock xml:space="preserve">conn.Start( prefList );</codeblock></info>
</step>
</steps>
<result id="GUID-1917764D-20B0-4FEE-B10B-62902CC90287">       <p>The application
is connected to the specified SNAP ID.</p>     </result>
</taskbody><related-links>
<link href="GUID-3490A064-8421-4ABB-9E93-99A5565CF4D7.dita"><linktext>Additional
Connection Preferences</linktext></link>
</related-links></task>