Hi all,
I have a problem, I like use the RSocket class but without use the CActive class for the asynchronous service.
The problem is in the RSocket::Read member if I use the User::WaitForResquest is blocking. I like read only if I have got data to read or have a Timeout.
I try to make this:
btsocket->Read(data,status);
int timeout = 1000;
RTimer timer;
TRequestStatus timerstatus;
int nsteps = 2;
int step = ((timeout*1000)/nsteps);
timer.CreateLocal();
timer.After(timerstatus,step);
for(;😉
{
User::WaitForAnyRequest();
if(timerstatus!=KRequestPending)
{
nsteps--;
if(!nsteps) break;
timer.After(timerstatus,step);
}
if(status!=KRequestPending) break;
}
if(timerstatus==KRequestPending) User::WaitForRequest(timerstatus);
timer.Close();
The problem is the Socket operation are pendient and I can�t eliminate. If I make:
static void RequestComplete(TRequestStatus*& aStatus,TInt aReason);
but... Don�t work. It makes error.
other possible solutions is try to use before that read:
err=btsocket->GetOpt(KSockSelectRead,KSOLSocket,bfr);
To know if there is data to read, but this don�t actualize the data (always have the same return).
Anyboy Can help me?
Any idea to resolve this...?
Best regards,
Sir Graham.