Hi all,
I've got this code that does not seem to be behaving as the API says it should, though I've modelled after the ECHO example. Here it is in part:
class TVNetReader : public CTimer {
...
}
void TVNetReader::ReadNextData() {
//Allocate buffer, then...
if (!IsActive()) {
printf ("ST2\n"😉;
printf ("ST2\n"😉;
iSocket.Recv(*bufPtr, 0, iStatus);
SetActive ();
}
}
void TVNetReader::RunL()
{
printf ("ST1: TVNetReader RunL\n"😉;
if (iStatus != KErrNone) {
//Handle error
return;
}
//else process the received data.
}
I've placed the printf statement there for debugging, and it never gets displayed. The RunL() function is never called for some reason, even after a significant delay of a few minutes.
On the other hand, I DID have some working code as follows:
void TVNetReader::ReadNextData() {
//Allocate buffer, then...
iSocket.Recv(*bufPtr, 0, iStat);
User::WaitForRequest (iStat);
if (iStat != KErrNone) {
//handle error.
} else {
//Process data.
}
}
This version, which uses WaitForRequest(), works like a charm. However since it is handled serially and introduces an unacceptable delay in the code, it is necessary that I be able to use the signalling mechanism so that other functions can be called while I am downloading data.
A few other notes:
In the first version, I'm using a class inherited from the CTimer class, which according to the API inherits from CActive. I did try inheriting from CActive as well before, with the same non-responsive results. In the course of testing out some other ideas, I switched it to CTimer instead. I am also using iStatus, in the first piece of code. The second one works fine whether I use iStatus or my own local function variable iStat.
What I've got is the second code that does receive data and handles it properly, but effectively suspends the entire program when User::WaitForRequest is called while it waits for the descriptor to be filled and Recv() to return. And then there is the first code that doesn't seem to receive any data at all, or at least RunL is never called even after enough time has passed to fill the descriptor completely.
Any help is greatly appreciated. Thanks!
Gregory