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();
}