Read-only archive of the All About Symbian forum (2001–2013) · About this archive

How can I disconnect connection which other applications have set up

1 replies · 2,120 views · Started 20 October 2005

I do it like that:
definite:
RConnection iConnection;
After I open iConnection:
iConnection.EnumerateConnections(iConnectionCount);
if (iConnectionCount>0)
{
TPckgBuf<TConnectionInfoV2> connectionInfo;
iConnection.GetConnectionInfo(iConnectionIndex, connectionInfo);
TInt result=iConnection.Attach(connectionInfo,iConnection.EAttachTypeNormal);
iConnection.Stop(iConnection.EStopNormal);
}

but,When I try it on simulator
"TInt result=iConnection.Attach(connectionInfo,iConnection.EAttachTypeNormal);" is wrong.
Please help me!Thank you so much.

Following code works on Symbian 7.0s:


void HTTPManager::CloseConnections() {
RSocketServ socketServer;
RConnection myConnection;

TPckgBuf<TConnectionInfoV2> connectionInfo;

TCommDbConnPref pref;
pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
pref.SetDirection(ECommDbConnectionDirectionOutgoing);

socketServer.Connect();
myConnection.Open(socketServer);

myConnection.EnumerateConnections( iNumberOfOpenConnections );

for(TUint i = 1; i <= iNumberOfOpenConnections; i++) {
myConnection.GetConnectionInfo(i, connectionInfo);

//Dont close WLAN, Ethernet and Bluetooth connections
if(connectionInfo().ConnectionType() < EConnectionEthernet) {
pref.SetIapId(connectionInfo().iIapId);
myConnection.Start(pref);
myConnection.Stop(RConnection::EStopNormal);
}
}

myConnection.Close();
socketServer.Close();
}