×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    5

    RunL is not called second time

    Hi,
    iam using active objects to receive resposnes from SIPServer.

    so first time i send a Request and call SetACtive(), it goes inside RunL(), and second time i send Request and call setactive(), it dosent come insdie RunL().

    socket.SendTo(sPacket,iaddr,0,iStatus);
    User::WaitForRequest(iStatus);
    if (iStatus == KErrNone )
    {
    SIPLog("Send Successfull");
    Start();
    }
    else
    {
    SIPLog("Send Unsuccessfull");
    TInt error = iStatus.Int();
    SIPLog("Send Error =%d",error);
    }

    EXPORT_C void CMyAbstract::Start()
    {
    if (!IsActive())
    {
    TRequestStatus *pstatus = &iStatus;
    User::RequestComplete(pstatus,KErrNone);
    SIPLog("Status set to KErrNone");
    SetActive();
    }
    }

    void RunL()
    {
    if (iStatus == KErrNone)
    {
    SIPLog("Start of CMyAbstract::RunL()");
    Receive(Request);
    }
    SIPLog("Inside Start");
    SIPLog("Setting status");
    SIPLog("End of CMyAbstract::RunL()");
    }

    and this is the receive function which is called by RunL()
    void CMyAbstract::Receive(TDes8& MethodSent)
    {
    SIPLog("Inside Receive Function");
    while(iret !=true)
    {
    SIPLog("before receive call");
    RespBuf.FillZ();
    socket.RecvFrom(RespBuf,iaddr,0,iStatus);//RespBuf holds the response
    //User::WaitForRequest(iStatus);
    // Copies the RespBuf to buffer
    buffer.FillZ();
    buffer.Copy(RespBuf); //copy of response
    // Log the buffer to Logger
    memset(RetPtr,0,MAX_SIZE);
    RetPtr = DescToString(buffer);//convertig Descriptor to string to log to Logger
    SIPLog("After converting from desc to string");
    SIPLog("Packet received");
    SIPLog(RetPtr);
    aParseBuf.FillZ();
    aParseBuf.Copy(RespBuf);//copy of response
    iret=ChekResponse(aParseBuf,socket,MethodSent);//if 200ok reveived returns True, else False
    if(iret == true)
    {
    SIPLog("Successful");
    }
    else
    {
    SIPLog("Out of chekresp, not received 200");

    }

    }//end while();

    }//Receive() closed
    Last edited by sowgandhikaramakrishna; 2008-06-16 at 10:43.

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    10

    Re: RunL is not called second time

    i think the request has not become KErrNone.so it is not coming to RunL()for the second time.Also check for active scheduler whether it is running or not.

    regards,
    Vijayshapov

  3. #3
    Super Contributor
    Join Date
    Jun 2005
    Location
    Berlin
    Posts
    721

    Re: RunL is not called second time

    if (!IsActive())
    {
    TRequestStatus *pstatus = &iStatus;
    User::RequestComplete(pstatus,KErrNone);
    SIPLog("Status set to KErrNone");
    SetActive();
    }


    !!! SetActive() only by 'no Active'!!!

  4. #4
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: RunL is not called second time

    if you want to issue second request only after first is completed, then you can provide notification (callback) to inform the caller that the request is completed with some status code.

  5. #5
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    146

    Re: RunL is not called second time

    Code:
    void CMyAbstract::Receive(TDes8& MethodSent)
    {
    SIPLog("Inside Receive Function");
    while(iret !=true)
    {
    SIPLog("before receive call");
    RespBuf.FillZ();
    socket.RecvFrom(RespBuf,iaddr,0,iStatus);
    Here you are calling async method without calling SetActive. Also, you do this in a loop, assuming the data is received immediately. It is not, you should wait for the data to be read when RunL is called and then issue another RecvFrom.

Similar Threads

  1. CActive object destructor not called
    By marmirman in forum Symbian C++
    Replies: 6
    Last Post: 2007-10-29, 06:51
  2. exe - destructor not being called
    By nubiah in forum Symbian C++
    Replies: 4
    Last Post: 2007-07-27, 10:25
  3. Replies: 5
    Last Post: 2006-03-10, 07:37
  4. Replies: 2
    Last Post: 2005-10-29, 10:31
  5. How to get correct time.
    By dzaga in forum Mobile Java General
    Replies: 2
    Last Post: 2003-08-06, 22:03

Posting Permissions

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