RunL() not getting hitted....

Login to reply to this topic.
Fri, 2006-04-28 11:38
Joined: 2006-04-08
Forum posts: 41
Hi,
i am testing my SocketManager dll using an exe.
I am runing my application on two different emulators on two different PCs.
Now what the Problem is:
on one of the emulator i am creating udp socket which is waiting for data to read, RecvFrom() is issued in Asynchronous mode n after that i have started my CActiveScheduler's Start() loop,now it is continuously waiting for the RunL() of reader object to be hitted.
on another emulator(which is running on another PC), i create a udp socket n then issue SendTo() call for sending data on the first emulator, now as soon as i issue SendTo() it gets successfull n emulator where i send the data gets closed, but irony is that its RunL() is not getting hitted(bcoz it is not issuing any logs in the log file).
N also i have checked through ethereal that data is reaching its destination IP n the specified port...
Could anybody suggest the reason behind it........HuhHuh

Regards,
Amit.

Fri, 2006-04-28 11:49
Joined: 2004-05-24
Forum posts: 982
Re: RunL() not getting hitted....
So actually your problem is that you're not able to receive data on the remote computer/emulator...right? Or?

pirosl

Fri, 2006-04-28 13:41
Joined: 2006-04-08
Forum posts: 41
Re: RunL() not getting hitted....
Quote from: pirosl
So actually your problem is that you're not able to receive data on the remote computer/emulator...right? Or?
Yeah, ofcourse i am not getting data on remote emulator. As soon as i issue SendTo() call from my source emulator then destination emulator gets closed, it's RunL() does not get hit.
How can it be possible that inspite of issuing RecvFrom() asynchronously, i start active scheduler's loop n emulator which have to receive data keeps on stucking in start()'s infinite loop n as soon as data arrives on the port where RecvFrom is issued, emulator gets closed.
i have also tried one thing that after issuing RecvFrom(), i have not started active scheduler's loop but even then as soon as i send data("Hi!How r u...??") from my source emulator to the destination emulator, it gets closed.
I am not being able to find it's reason...
bcoz even i can't set breakpoint anywhere to check where this illwill is hapening.....

Regards,
Amit.
Fri, 2006-04-28 13:49
Joined: 2004-05-24
Forum posts: 982
Re: RunL() not getting hitted....
I think you're going to far to search the problem....you're assuming that your problem is in ao.....but you haven't told us if you're sure that your socket on remote machine receives smth and  if there is indeed smb who read it....

pirosl

Fri, 2006-04-28 14:24
Joined: 2006-04-08
Forum posts: 41
Re: RunL() not getting hitted....
Quote from: pirosl
I think you're going to far to search the problem....you're assuming that your problem is in ao.....but you haven't told us if you're sure that your socket on remote machine receives smth and  if there is indeed smb who read it....
That is what i am not being able to determine whether receiving socket has received something or not...bcoz how can i come to know it without getting into the RunL()...
Fri, 2006-04-28 14:33
Joined: 2005-02-12
Forum posts: 98
Re: RunL() not getting hitted....
Use Ethreal Software to see http packets on Network.That will be very helpful.
Fri, 2006-04-28 14:49
Joined: 2006-04-08
Forum posts: 41
Re: RunL() not getting hitted....
Quote from: vikas_bansal
Use Ethreal Software to see http packets on Network.That will be very helpful.

Buddy, i am already saying in start of this thread that i am using ethereal software on the destination end emulator where i have to receive data n it is showing data packets arriving on the specified port where RecvFrom() is issued.
Fri, 2006-04-28 14:53
Joined: 2004-05-24
Forum posts: 982
Re: RunL() not getting hitted....
Just checking....is your active object which issued the request to RSocket added in active scheduler? Also is the active scheduler started?

pirosl

Fri, 2006-04-28 15:10
Joined: 2006-04-08
Forum posts: 41
Re: RunL() not getting hitted....
Quote from: pirosl
Just checking....is your active object which issued the request to RSocket added in active scheduler? Also is the active scheduler started?
yeah, reader object added to the AS n active scheduler has started,
here i give u snippets from my code:

*************************************************************
//socket reader header.
*************************************************************
class CUdpSocketReader:public CActive
{
private:
   CSocket *aOurSocket;   
   //Will contain pointer to the socket which is containing this CUdpSocketReader object.
   
   LogManager *iLogManager;

   RSocket& iSocket;
   //Will be initialised with iSocket object contained in CSocket base class
   //which is containing this iSocket object.

   HBufC8 *ReadBuffer;
   //It will contain the received data.

   TInetAddr anAddr;
   //Will contain the address of remote host.

public:
   static CUdpSocketReader* NewLC(CSocket *aSocket,RSocket& aSocketRef,TUint aReceivedDataBufferSize,LogManager* aLogManagerPtr);

   static CUdpSocketReader* NewL(CSocket *aSocket,RSocket& aSocketRef,TUint aReceivedDataBufferSize,LogManager* aLogManagerPtr);

   void ConstructL(TUint aReceivedDataBufferSize);

   CUdpSocketReader(CSocket *aSocket,RSocket& aSocketRef,LogManager* aLogManagerPtr);
   //Will allocate memory to the ReadBuffer pointer variable on Heap.
   //How much memory to allocate will be passed as argument in NewL() or NewLC().   

   ~CUdpSocketReader();

   TInt ReadAsync(MHSSSocketMgrCallback* aEventListenerPtr=NULL);
   //Will issue Read() function of RSocket object Asynchronously.
   //Returns 1 for success n -1 for failure(if any).

   TInt RecvFromAsync(MHSSSocketMgrCallback* aEventListenerPtr=NULL);
   //Returns 1 for success n -1 for failure.
   //Will issue RcvFrom() function of RSocket object Asynchronously.   

   void GetLengthOfDataRcvd(TUint& aLengthRef);
   //Synchronous implementation.
   //Length of Data will be returned in the aLengthRef through iLength variable.

   void GetReadBufData(TDesC8& aBufferRef);
   //Synchronous implementation.
   //Data will be returned in the aBufferRef argument.
   
   void GetUdpRcvdBuffer(TDes8& aBufferRef,TDes& aRemoteIpAddrRef,TUint& aRemotePortRef);
   //will return Data, Remote IP n Port in the arguments of above function.

   void RunL();
   //From CActive.

   void DoCancel();
   //From CActive.
};
//end of header file.
*****************************************************************

CUdpSocketReader* CUdpSocketReader::NewLC(CSocket *aSocket,RSocket& aSocketRef,TUint aReceivedDataBufferSize,LogManager* aLogManagerPtr)

{
   CUdpSocketReader* self = new (ELeave) CUdpSocketReader(aSocket,aSocketRef,aLogManagerPtr);
   CleanupStack::PushL(self);
   self->ConstructL(aReceivedDataBufferSize);
   return self;
}

CUdpSocketReader* CUdpSocketReader::NewL(CSocket *aSocket,RSocket& aSocketRef,TUint aReceivedDataBufferSize,LogManager* aLogManagerPtr)
{
   CUdpSocketReader* self = CUdpSocketReader::NewLC(aSocket,aSocketRef,aReceivedDataBufferSize,aLogManagerPtr);
   CleanupStack::Pop();
   return self;
}

void CUdpSocketReader::ConstructL(TUint aReceivedDataBufferSize)
{
   ReadBuffer = HBufC8::NewL(aReceivedDataBufferSize);   
   CActiveScheduler::Add( this );   
}

CUdpSocketReader::CUdpSocketReader(CSocket *aSocket,RSocket& aSocketRef,LogManager* aLogManagerPtr)
            :CActive( EPriorityStandard ),
            aOurSocket(aSocket),
            iSocket(aSocketRef),
            iLogManager(aLogManagerPtr)
{
}

void CUdpSocketReader::RunL()
{
         iLogManager->LmPrint(Debug,_L("%s"),_S(RunL hitted));
   if(iStatus == KErrNone)
      aOurSocket->CallbackToSocket(EHSSDataReceived,iStatus.Int());
   else   
      aOurSocket->CallbackToSocket(EHSSDataReceivingFailed,iStatus.Int());
}


TInt CUdpSocketReader::RecvFromAsync(MHSSSocketMgrCallback* aEventListenerPtr)
{
   if(IsActive())
      return -1;
   iSocket.RecvFrom(ReadBuffer->Des(),anAddr,0,iStatus);
   //iStatus variable is from CActive class.

   SetActive();//From CActive.
   return 1;
}

After this point control returns back to the statement in my exe which is:
CActiveScheduler::Start();

n after it program is in waiting state, i am assuming that it is in AS's start loop n waiting for RunL() of RecvFrom() to be hitted.
But as soon as data arrives on this port where socket has issued RecvFrom(), emulator gets closed, RunL() does not get hit.
Fri, 2006-04-28 15:23
Joined: 2004-05-24
Forum posts: 982
Re: RunL() not getting hitted....
The code seems ok.....but question...where do you accept the connection? (where is the Accept call?)

pirosl

Fri, 2006-04-28 15:31
Joined: 2006-04-08
Forum posts: 41
Re: RunL() not getting hitted....
Quote from: pirosl
The code seems ok.....but question...where do you accept the connection? (where is the Accept call?)
I am using UDP sockets, so no question of calling Accept()....
I am just issuing RacvFrom() on some UDP socket.
Mon, 2006-05-01 04:41
Joined: 2004-05-31
Forum posts: 51
Re: RunL() not getting hitted....
I can't seen any problems with this, but have you tried implementing CUdpSocketReader::RunError() (see CActive docs) and seeing if that gets called?

B
Mon, 2006-05-01 05:16
Joined: 2006-04-08
Forum posts: 41
Re: RunL() not getting hitted....
Quote from: broberts
I can't seen any problems with this, but have you tried implementing CUdpSocketReader::RunError() (see CActive docs) and seeing if that gets called?

B
Nothing is getting called neither RunL() nor RunError(), bcoz irony is that even if i don't start active scheduler's loop from within my exe, even then as soon as data reaches at the specified port(where RecvFrom() is issued), emulator gets closed, i think this problem is not related to active object fundas, this is something else....
Can u suggest any reason behind it...that why it is so....that as soon as data reaches on the port, enulator gets closed irrespective of whether i have started AS or not...

Amit.
Fri, 2006-09-15 08:03
Joined: 2006-09-15
Forum posts: 3
Re: RunL() not getting hitted....
I am also facing the same problem. Has anyone found any solution Huh
In my case, I create a UDP server socket which calls RecvFrom() from a separate thread and one UDP client socket to send data to a test SIP server running on different location on ethernet. Through ethereal I have checked that the data is sent and received successfully in my machine but server socket's RunL() is never called.
In fact the server socket thread stops responding when data reaches on my machine.
While creating sockets, I am successfully able to do RConnection.Start() with ethernet profile. For server socket Bind is also successful.
Please help if anyone knows the solution. 
  • Login to reply to this topic.