You Are Here:

Community: Developer Discussion Boards

#1 Old The ubiquitous E32USER-CBase 46 - 2003-08-26, 10:04

Join Date: Aug 2003
Posts: 41
vasilak
Offline
Registered User
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
Reply With Quote

#2 Old Stray signal - 2003-08-26, 11:59

Join Date: Aug 2003
Posts: 1,005
Location: Oulu, Finland
laa-laa's Avatar
laa-laa
Offline
Forum Nokia Champion
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
Reply With Quote

#3 Old Re: Stray signal - 2006-08-16, 11:29

Join Date: Mar 2006
Posts: 129
Location: India
Send a message via Yahoo to anand_zain76
anand_zain76's Avatar
anand_zain76
Offline
Regular Contributor
Hi,
Is it possible to resume our thread after suspending by User::WaitForRequest().
-Anand
Reply With Quote

#4 Old Re: The ubiquitous E32USER-CBase 46 - 2008-09-04, 20:10

Join Date: May 2008
Posts: 28
inxstech
Offline
Registered User
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
}
Reply With Quote

#5 Old Re: The ubiquitous E32USER-CBase 46 - 2008-09-08, 10:35

Join Date: Mar 2008
Posts: 576
mahbub_s60's Avatar
mahbub_s60
Offline
Forum Nokia Expert
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().


-Mahbub
Reply With Quote

#6 Old Re: Stray signal - 2008-09-08, 10:43

Join Date: Mar 2008
Posts: 576
mahbub_s60's Avatar
mahbub_s60
Offline
Forum Nokia Expert
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.


-Mahbub
Reply With Quote

#7 Old Re: The ubiquitous E32USER-CBase 46 - 2008-09-08, 10:49

Join Date: Mar 2008
Posts: 576
mahbub_s60's Avatar
mahbub_s60
Offline
Forum Nokia Expert
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
}


-Mahbub
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia