Hi,

from some historical reasons we're using RGenericAgent for creating connection. Immediately after connection is established we save IAP informations:

struct SIAPTableRecord
{
TUint32 iId;
TBuf<KDefaultTextColumnWidthIAP> iName;
TUint32 iIAPService;
TBuf<KDefaultTextColumnWidthIAP> iIapServiceType;
}

TInt GetActualPrefL( CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref& aPref, SIAPTableRecord& aIAP )
{
if ( ( iState == EPINCConnected ) ||
( iState == EPINCGettingIPAddress ) )
{
TInt err = KErrNone;
if ( ( ( err = iAgent.GetActiveIntSetting( TPtrC( IAP ), TPtrC( COMMDB_ID ) , aIAP.iId ) ) == KErrNone ) &&
( ( err = iAgent.GetActiveDesSetting( TPtrC( IAP ), TPtrC( COMMDB_NAME ), aIAP.iName ) ) == KErrNone ) &&
( ( err = iAgent.GetActiveIntSetting( TPtrC( IAP ), TPtrC( IAP_SERVICE ) , aIAP.iIAPService ) ) == KErrNone ) &&
( ( err = iAgent.GetActiveDesSetting( TPtrC( IAP ), TPtrC( IAP_SERVICE_TYPE ) , aIAP.iIapServiceType) ) == KErrNone ) )
{
///////////////////////////////////////////////////
//
// Get connection preferences
//
///////////////////////////////////////////////////
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref tmp_pref;
CCommsDatabase* comms_db = CCommsDatabase::NewL();
CleanupStack::PushL( comms_db );
CCommsDbConnectionPrefTableView* conn_prefs =
comms_db->OpenConnectionPrefTableInRankOrderLC( ECommDbConnectionDirectionOutgoing );

err = conn_prefs->GotoFirstRecord();
while ( err == KErrNone )
{
conn_prefs->ReadConnectionPreferenceL( tmp_pref );
if ( tmp_pref.iBearer.iIapId == aIAP.iId )
{
aPref = tmp_pref;
break;
}
err = conn_prefs->GotoNextRecord();
};

CleanupStack::PopAndDestroy( conn_prefs );
CleanupStack::PopAndDestroy( comms_db );

// check if record in connection preferences was found
if ( err != KErrNone )
return KErrConnectionPreferences;

return KErrNone;
}
else
return err;
}
else
return KErrNotReady;
}

It works PERFECTLY. But after sometime I want to close the connection, but because the user simoutanesly to my connection created new one (WAP one for example), I tried to enumearte existing connections using code:

void EnumerateConnectionL()
{
// socket server
RSocketServ serv;
User::LeaveIfError( serv.Connect() );
CleanupClosePushL( serv );

// The management interface for a network connection.
RConnection conn;
conn.Open( serv, KConnectionTypeDefault );
CleanupClosePushL( conn );

TUint count;
User::LeaveIfError( conn.EnumerateConnections( count ) );

for ( TUint i = 0; i < count; i++ )
{
TPckgBuf<TConnectionInfoV2> connectionInfo;
conn.GetConnectionInfo( i, connectionInfo );
}

CleanupStack::PopAndDestroy( 2 );
}

This code found expectec amounnt of connection (one or two in my case). ALso works perfectly

MY PROBLEM:
===========
Now values saved by shwn method GetActualPrefL() from IAP table are:
IAPServiceType:OutgoingGPRS
IAPRecordName:conn1
IAPId:1
IAPService:2

So I expected, that EnumerateConnectionL() will return the same IAPId id, but instead it returns me those values:
TConnectionInfo::iIapId = 0;
TConnectionInfo::iNetId = 0;

What are those values???

I tried following code:
TBool FindIAPL( TUint32& aIapId )
{
CCommsDatabase* comms_db = CCommsDatabase::NewL();
CleanupStack::PushL( comms_db );

CCommsDbTableView* tableView = comms_db->OpenTableLC( TPtrC( IAP ) );

TUint32 iapId( 0 );
TInt retval = tableView->GotoFirstRecord();

while ( retval == KErrNone && iapId == 0 )
{
TBuf< KCommsDbSvrMaxFieldLength > serviceName;
tableView->ReadTextL( TPtrC( COMMDB_NAME ), serviceName );
tableView->ReadUintL( TPtrC( COMMDB_ID ), iapId );


if ( iapId == aIapId )
{
CleanupStack::PopAndDestroy( tableView );
CleanupStack::PopAndDestroy( comms_db );
return ETrue;
}

retval = tableView->GotoNextRecord();
}

CleanupStack::PopAndDestroy( tableView );
CleanupStack::PopAndDestroy( comms_db );
return EFalse;
}

I didn't found anything!!!! What is sense of those values?? Look on dump of my IAP table:

[IAP]
ADD_SECTION
# COMMDB_ID = 1
Name=ANF-intranet01
IAPService=2
IAPServiceType=OutgoingGPRS
IAPBearer=2
IAPBearerType=ModemBearer
IAPNetwork=1
IAPNetworkWeighting=0
Location=2
FIELD_COUNT=8
END_ADD

PLEASE HELP!!!!!!!!

Thanks a lot
STeN