Opening a Connection to a SNAP by specifying SNAP Type

Extended Connection Preferences API can be used by applications to set the SNAP type prior to establishing a connection.

Specifying SNAP type enables the applications to start a connection to a specific SNAP (For example, Internet SNAP or Intranet SNAP) without iterating through the SNAP list to identify the appropriate type.

  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. Set the SNAP type using TExtendedConnPref::SetSnapPurpose() .
            preferences.SetSnapPurpose( CMManager::ESnapPurposeInternet );
           
  5. Append the extended connection preferences into connection preference list.
            prefList.AppendL( &preferences );
           
  6. Start a connection with connection preferences.
            conn.Start( prefList );
           

The application is connected to Internet SNAP.