Programmation C++ RSocketServ => Accept ?

This is a discussion on Programmation C++ RSocketServ => Accept ? within the Symbian forums in Other Technologies category; 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 ...

Go Back   Application Development Forum > Other Technologies > Symbian

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #11  
Old 08-01-2008, 10:14 AM
Alan Montgomery
Guest
 
Default Re: Programmation C++ RSocketServ => Accept ?

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
Reply With Quote
  #12  
Old 08-13-2008, 06:01 AM
adetaylor
Guest
 
Default Re: Programmation C++ RSocketServ => Accept ?

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
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:18 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.