×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    41

    The ubiquitous E32USER-CBase 46

    Hi,

    I 've been trying to open an L2CAP socket on the N3650 mobile in order to exchange some data with a linux PC via bluetooth.
    The code snippet I use is shown below:

    --------------------------------------------------------------------------------
    TRequestStatus socketStatus, timerStatus;
    socket->Accept(*blank, socketStatus);
    SetSecurity(false, false, false, 5);

    RTimer timer;
    timer.CreateLocal();
    timer.After(timerStatus, timeout);

    User::WaitForRequest(timerStatus, socketStatus);

    timer.Cancel();
    timer.Close();

    //Check the socket status
    if(socketStatus == KErrNone)
    return 1;
    else
    socket->CancelAccept();
    --------------------------------------------------------------------------------

    There are 2 cases here: either the timer expires and the accept operation is aborted or a connection is made within the specified timeout.
    The problem is that in both (!) cases a E32USER-CBase 46 exception is thrown. In the first case the exception is thrown immediately while in the second after a little while (but before the timeout expires). Where is the problem here?
    The exception means that an Accept request is being made while there is another active accept operation. Is CancelAccept() causing the problem here? And where is the problem when an incoming connection actually gets accepted?

    thnx

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Stray signal

    E32BASE-CBase 46 panic is stray signal detected by the active scheduler. That means, a request is completed but there is no object to handle the completion. The requests may either complete normally or by cancellation.

    In your case, you have two requests, but you only WaitForRequest() once. This messes up your thread's request semaphore. You should WaitForRequest() again for the completion of the other request. Since its status is KErrCancel and not KRequestPending, the wait will return immediately.

    Asynchronous requests are really easier to handle with CActive-derived objects, in your case one for the timer and one for the socket connection. Whichever completes first would then Cancel() the other in its RunL().

    Lauri

  3. #3
    Regular Contributor
    Join Date
    Mar 2006
    Location
    India
    Posts
    138

    Re: Stray signal

    Hi,
    Is it possible to resume our thread after suspending by User::WaitForRequest().
    -Anand

  4. #4
    Registered User
    Join Date
    May 2008
    Posts
    28

    Re: The ubiquitous E32USER-CBase 46

    am getting Error message of "E32User-CBase 46" for RSocket (CActive) tel me how to handle r solve this problem

    example code:
    SocketIO::SocketIO(): CActive(EPriorityStandard)
    {
    requestId = 0;
    //connectToMSF();
    }

    void SocketIO::connectToMSF()
    {
    TInetAddr address;
    TRequestStatus iStatus;
    buf = (char*)malloc(sizeof(char)*256);
    CActiveScheduler::Add(this);
    RHostResolver resolver;
    TNameEntry entry;
    User::LeaveIfError(iSocketServ.Connect());
    User::LeaveIfError(resolver.Open(iSocketServ, KAfInet, KProtocolInetTcp));
    CleanupClosePushL( resolver );

    resolver.GetByName(_L("192.168.2.124"), entry);

    CleanupStack::PopAndDestroy();//for resolver

    address.SetAddress((TInetAddr::Cast(entry().iAddr)).Address());
    //address.SetAddress(iaddr);
    address.SetPort(2800);
    address.SetFamily( KAfInet );
    iRunState=ESocketConnected;
    User::LeaveIfError(clientSockId.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));
    clientSockId.Connect(address, iStatus);
    //User::WaitForRequest(iStatus);

    SetActive();
    }

    void SocketIO::RunL()
    {
    switch ( iRunState )
    {
    case ESocketConnected: //After Initating connection i //will be getting one msg from server
    if(iStatus == KErrNone)
    readDatastrt();
    break;

    case EGetRequestSent:
    sendData(buf);
    break;

    case EDataReceived:
    readData(echoID);
    break;

    case EConnectionClosed:
    break;

    default:
    break;
    } // end switch
    }

  5. #5
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: The ubiquitous E32USER-CBase 46

    Quote Originally Posted by vasilak View Post
    Hi,

    I 've been trying to open an L2CAP socket on the N3650 mobile in order to exchange some data with a linux PC via bluetooth.
    The code snippet I use is shown below:

    --------------------------------------------------------------------------------
    TRequestStatus socketStatus, timerStatus;
    socket->Accept(*blank, socketStatus);
    SetSecurity(false, false, false, 5);

    RTimer timer;
    timer.CreateLocal();
    timer.After(timerStatus, timeout);

    User::WaitForRequest(timerStatus, socketStatus);

    timer.Cancel();
    timer.Close();

    //Check the socket status
    if(socketStatus == KErrNone)
    return 1;
    else
    socket->CancelAccept();
    --------------------------------------------------------------------------------

    There are 2 cases here: either the timer expires and the accept operation is aborted or a connection is made within the specified timeout.
    The problem is that in both (!) cases a E32USER-CBase 46 exception is thrown. In the first case the exception is thrown immediately while in the second after a little while (but before the timeout expires). Where is the problem here?
    The exception means that an Accept request is being made while there is another active accept operation. Is CancelAccept() causing the problem here? And where is the problem when an incoming connection actually gets accepted?

    thnx
    Hi,
    What are you doing with the timer when the socket status is complete by this statement
    if(socketStatus == KErrNone)
    return 1;
    Your timer is complete later and it is not handled, you have to cancel the timer and close it. Same thing should be done for socket if the timer event come first. You should try to use AO than using WaitForRequest().

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Stray signal

    Quote Originally Posted by anand_zain76 View Post
    Hi,
    Is it possible to resume our thread after suspending by User::WaitForRequest().
    -Anand
    Hi,
    I think you can't resume the thread by yourself, it is suspended by system. If you want to continue using the thread then you should use active objects. With active objects, you can make a request to service provider and after that you can continue using the thread (thread is not blocked). When the service provider has finished the task then your RunL() will be called. But with WaitForRequest() you have to wait until the service provider has finished the task.

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: The ubiquitous E32USER-CBase 46

    Hi,
    How you are using SocketIO object?
    This should be alive until the RunL is called.
    If you destroy (for example) the object or the object goes out of scope then you don't have any object that can handle your request that is completed later.
    So don't allow the SocketIO object to go out of scope.


    Quote Originally Posted by inxstech View Post
    am getting Error message of "E32User-CBase 46" for RSocket (CActive) tel me how to handle r solve this problem

    example code:
    SocketIO::SocketIO(): CActive(EPriorityStandard)
    {
    requestId = 0;
    //connectToMSF();
    }

    void SocketIO::connectToMSF()
    {
    TInetAddr address;
    TRequestStatus iStatus;
    buf = (char*)malloc(sizeof(char)*256);
    CActiveScheduler::Add(this);
    RHostResolver resolver;
    TNameEntry entry;
    User::LeaveIfError(iSocketServ.Connect());
    User::LeaveIfError(resolver.Open(iSocketServ, KAfInet, KProtocolInetTcp));
    CleanupClosePushL( resolver );

    resolver.GetByName(_L("192.168.2.124"), entry);

    CleanupStack::PopAndDestroy();//for resolver

    address.SetAddress((TInetAddr::Cast(entry().iAddr)).Address());
    //address.SetAddress(iaddr);
    address.SetPort(2800);
    address.SetFamily( KAfInet );
    iRunState=ESocketConnected;
    User::LeaveIfError(clientSockId.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));
    clientSockId.Connect(address, iStatus);
    //User::WaitForRequest(iStatus);

    SetActive();
    }

    void SocketIO::RunL()
    {
    switch ( iRunState )
    {
    case ESocketConnected: //After Initating connection i //will be getting one msg from server
    if(iStatus == KErrNone)
    readDatastrt();
    break;

    case EGetRequestSent:
    sendData(buf);
    break;

    case EDataReceived:
    readData(echoID);
    break;

    case EConnectionClosed:
    break;

    default:
    break;
    } // end switch
    }

Posting Permissions

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