×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    135

    RConnection hang when there is no internet Connection+No signal bar firsttime

    Hi all,

    i am checking internet connection before i start my web service using RConnection

    for that i have written code

    void CConnectionEngine::ConstructL()
    {
    //open socket server and start the connection
    User::LeaveIfError(iSocketServ.Connect());
    User::LeaveIfError(iConnection.Open(iSocketServ));
    CActiveScheduler::Add(this);

    iTimer = CPeriodic::NewL(CActive::EPriorityStandard);

    }

    void CConnectionEngine:oCancel()
    {

    //iConnection.CancelAllInterfaceNotification();
    iConnection.Stop(RConnection::EStopAuthoritative);
    }


    void CConnectionEngine::StartL()
    {

    // open the IAP communications database
    CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
    CleanupStack::PushL(commDB);

    // initialize a view
    CCommsDbConnectionPrefTableView* commDBView =
    commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);
    // go to the first record
    User::LeaveIfError(commDBView->GotoFirstRecord());
    // Declare a prefTableView Object.
    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
    // read the connection preferences
    commDBView->ReadConnectionPreferenceL(pref);

    // pop and destroy the IAP View
    CleanupStack::PopAndDestroy(commDBView);

    // pop and destroy the database object
    CleanupStack::PopAndDestroy(commDB);


    iIAP = pref.iBearer.iIapId;

    TUint32 rank = pref.iRanking;
    // setup preferences
    iConnectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    iConnectPref.SetDirection(ECommDbConnectionDirectionUnknown);
    iConnectPref.SetIapId(iIAP);//iapID);//Previous

    iConnection.Start(iConnectPref,iStatus);
    SetActive();

    StartTimer();

    }



    void CConnectionEngine::RunL()
    {
    TInt status = iStatus.Int() ;
    if(iStatus.Int() != KErrNone )
    {
    iObserver.PrefferedIAP(status,iIAP);
    ResetTheArray();
    }
    if(iStatus.Int() == KErrNone )
    {
    StopTimer();
    iIAP = iConnectPref.IapId();
    iObserver.PrefferedIAP(status,iIAP);
    }
    }



    void CConnectionEngine::ResetTheArray()
    {
    //iConnection.Stop(RConnection::EStopNormal);
    Cancel();
    iConnectPref.SetDialogPreference(ECommDbDialogPrefPrompt);
    iConnectPref.SetDirection(ECommDbConnectionDirectionUnknown);
    /*if(IsActive())
    {
    Cancel();
    }*/
    iConnection.Start(iConnectPref,iStatus);
    SetActive();

    }



    void CConnectionEngine::StartTimer()
    {
    TCallBack callback(NoResponseFromServer,this);
    if(iTimer->IsActive())
    {
    return;
    }
    iTimer->Start(KTimeIntervalForQueue,KTimeIntervalForQueue,callback);

    }





    void CConnectionEngine::StopTimer()
    {
    if(iTimer->IsActive())
    {
    iTimer->Cancel();
    }
    }



    TInt CConnectionEngine::NoResponseFromServer(TAny *aPtr)
    {

    CConnectionEngine *servmgr = static_cast<CConnectionEngine *>(aPtr);
    servmgr->StopTimer();
    servmgr->ResetTheArray();
    //servmgr->iConnection.Stop(RConnection::EStopNormal);
    //servmgr->Cancel();
    //servmgr->iStatus = KErrCancel;
    //servmgr->RunL();


    }

    when i call start using active object it hang out and after setting timer and also calling cancel() it aslo hang

    if i use synchronous start() of RConnection() it also hang

    plz tell me any body if you have any solution

    thanks in advance

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,566

    Re: RConnection hang when there is no internet Connection+No signal bar firsttime

    RConnection::Stop may require NetworkControl capability. You could check if Close helps.

  3. #3
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    135

    Re: RConnection hang when there is no internet Connection+No signal bar firsttime

    hi,

    thanks for reply ,

    i have one more problem

    when i start first time with RConnction

    iIAP = pref.iBearer.iIapId;

    TUint32 rank = pref.iRanking;
    // setup preferences
    iConnectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    iConnectPref.SetDirection(ECommDbConnectionDirectionUnknown);
    iConnectPref.SetIapId(iIAP);//iapID);//Previous




    it gives me -190 error means connection not ready though there is connection and it is in infinite loop

    can u plz tell me where is wrong step

    1)Using RSocket in my prev application i can find acces point very right.

    1)But Using RConnection ,i am getting wrong access point id.

    my process is simple whatever user experience in browsing, i want to give in my application.

    thanks in advance



    bye
    Last edited by rahul.shalik.makode; 2010-09-06 at 15:05.

Similar Threads

  1. How to get connection id of a RConnection object
    By zumbi in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2010-05-28, 04:45
  2. Replies: 1
    Last Post: 2009-10-11, 06:40
  3. RSSI = Signal Bar
    By resfiando in forum General Development Questions
    Replies: 3
    Last Post: 2008-07-31, 02:21
  4. RConnection::Start opens internet connection?
    By machiel in forum Wired and Wireless interfaces (Closed)
    Replies: 2
    Last Post: 2008-05-26, 15:46
  5. Program hang when user deny the network connection
    By pop2518 in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2003-10-31, 07:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •