Opening a Connection based on User Selection

Extended Connection Preferences API can be used by applications to open a connection based on user selection.

Context

When an application chooses to establish a connection based on user selection, Connection selection dialog needs to be enabled. Only the SNAPs and IAPs matching with bearer set are displayed for selection.

Steps

  1. Connect to socket server .

    RSocketServ ss;
    ss.Connect();       
  2. Open a RConnection object.

    RConnection conn;
    conn.Open( ss );
  3. Create a connection preference list and extended connection preferences object.

    TConnPrefList prefList;
    TExtendedConnPref preferences;    
  4. Enable the Connection selection dialog to accept user queries using TExtendedConnPref::SetConnSelectionDialog().

    preferences.SetConnSelectionDialog( ETrue );
  5. Append extended connection preferences into connection preference list.

    prefList.AppendL( &preferences );
  6. Start a connection with connection preferences.

    conn.Start( prefList );

Results

The application is connected to the SNAP or IAP selected by the user.

Related tasks