| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#11
| |||
| |||
| On Fri, 01 Aug 2008 14:18:44 +0100, spotlessmind33 wrote: > Hi, Okay for this value, but, now i use CActive : ------------ > s.accept(blank,iAStatus); > setActive(); ... --------- But in my RunL, when it's after the function > accept, > iAStatus has got a -KMaxTInt... With this, i can't use Recv, why ? have > you got > a solution for waiting a changement of iAStatus and continu to execute > the > program in the great condition ? Thanks! Guillaume The normal is to call SetActive and return from the RunL then when the acept completes RunL will be called again - you probably will need a state variable to indicate what you are waiting for. -- Alan Montgomery /"\ \ / ASCII ribbon campaign X against HTML mail / \ and postings - est. June 1998 |
|
#12
| |||
| |||
| Hi Guillaume, Your code should be something like this: CMyActiveObject::Start() { // can call this method whatever you want // Create iSocket and iBlankSocket // Start iSocket listening iSocket.Accept(iBlankSocket, iStatus); SetActive(); } void CMyActiveObject::RunL() { if (iStatus.Int() =3D=3D KRequestPending) { // Should never ever happen! If so, something odd has happened with the= active=20 // scheduler framework. RunL should not be called directly by you - it = should be called // by Symbian OS whenever the Accept has finished. } else if (iStatus.Int() !=3D KErrNone) { // Some error has occurred, and iStatus.Int() will give you a clue what= .. } else { // Accept succeeded! Now you can do iBlankSocket.Recv or similar // As Alan says, you will probably want to do other asynchronous // operations now, which means you will need to make this RunL // do stuff like: // iMyState =3D ESomeOtherState; // iBlankSocket.Recv(..., iStatus); // SetActive(); // and then alter this whole RunL to behave differently dependent on i= MyState, // gradually stepping through each asynchronous operation until you've = done // what you want. } } void CMyActiveObject: oCancel() {// Adding this line will enable your code elsewhere to call CMyActiveObje= ct::Cancel() // e.g. when your application is shutting down iSocket.CancelAccept(); } Ade |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.