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.