×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    9

    E32USER-CBase 46 when call RSocket::Connect()

    Hi all,

    I so sorry when I post this topic again, I have read all other discussion about this problem, but I haven't way to solve my problem
    Code:
    My CSocketEngine  class
    
    void CSocketEngine::ConstructL()
    	{
    	iState = EInitialized;
    	User::LeaveIfError(iTimer.CreateLocal());
    	CActiveScheduler::Add(this);
    	}
    
    -----------------------------------------
    
    void CSocketEngine::StartL()
    	{
    	if (IsActive())
    		{
    		Cancel(); // Cancel any request, just to be sure
    		}
    	if (iState == EInitialized)
    		{
    		iState = ENotConnected;
    		ConnectDirectly();
    		}
    	else if (iState == ENotConnected)
    		{
    		iTimer.After(iStatus, 20000000);// after 20s client with connect to server, get content from server
    		SetActive();
    		}
    	}
    -----------------------------------------
    
    void CSocketEngine::ConnectDirectly()
    	{
    	TInt err = iSocketServ.Connect();
    	if (err != KErrNone && err != KErrAlreadyExists)
    		{
    		User::Leave(err);
    		}
    
    	TInetAddr iAddress;
    	if (iAddress.Input(iServerName) == KErrNone)
    		{
    		User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream,
    				KProtocolInetTcp));
                    //I have check address and port, 
    		iAddress.SetPort(iPort);
    		iSocket.Connect(iAddress, iStatus);
    
                    //iSocket.Read(iBuffer, iStatus); received data is OK (iBuffer = content is sent by server) if I use this code
    
    		iState = EConnected;
    		iTimer.After(iStatus, KTimeOut);//10 seconds
    		SetActive();
    		}
    	}
    
    -----------------------------------------
    
    void CSocketEngine::RunL()
    	{
    	Cancel();
    	if (iStatus == KErrNone)
    		{
    		switch (iState)
    			{
    			case ENotConnected://process when reconnect
    				ConnectDirectly();
    				break;
    			case EConnected://process when iSocket.Connect() success
    				iSocket.Read(iBuffer, iStatus);
    				iSocket.Close();
    				iSocketServ.Close();
    				iState = ENotConnected;
    				StartL();
    				break;
    			default:
    				User::Panic(KPanicSocketSample, EError);
    				break;
    			}
    		}
    	else
    		{
    		StartL();
    		}
    	}
    When I debud to
    Code:
                    iState = EConnected;
    		iTimer.After(iStatus, KTimeOut);//10 seconds
    		SetActive();
    the panic E32USER-CBase 46 was rised

    I have use iStatus of CActive, I define RTimer iTimer; in my CSocketEngine class

    Please help me,
    Thanks all !
    Đời vẽ tôi ... tên mục đồng

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: E32USER-CBase 46 when call RSocket::Connect()

    it is normal stray signal panic, so do make sure you only have one request active per active object at all times, and that you call SetActive() after making the request..

    In your code you are calling socket connect & timer After with same iStatus same time, thus do chekc the original sockets example for better implementations..

  3. #3
    Registered User
    Join Date
    Jun 2008
    Location
    India
    Posts
    1,048

    Re: E32USER-CBase 46 when call RSocket::Connect()

    In which asynchronous request you are getting this problem in timer request or in socket reading? In function connectDirectly when you issues a request for socket reading you would come to RunL();

    In RunL you are issuing again an asynchronous request and then you go to startL() again in which you issues timer request. These consecutive request can be your problem .

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    9

    Re: E32USER-CBase 46 when call RSocket::Connect()

    Quote Originally Posted by symbianyucca View Post
    In your code you are calling socket connect & timer After with same iStatus same time, thus do chekc the original sockets example for better implementations..
    Thank you symbianyucca & sumit.rathi

    I have use CTimer instead of RTimer the panic wasn't rised, iBuffer can receive one time, but when StartL() is called again, the panic was rised

    May be, as sumit.rathi said:

    Quote Originally Posted by sumit.rathi View Post
    In RunL you are issuing again an asynchronous request and then you go to startL() again in which you issues timer request. These consecutive request can be your problem .
    I want after period of time, my client connect to server to get content so that I call StartL() again
    Anybody can have a way to help me solve this problem?

    Thank a lot !
    Last edited by mucdong; 2009-07-09 at 10:46.
    Đời vẽ tôi ... tên mục đồng

  5. #5
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: E32USER-CBase 46 when call RSocket::Connect()

    There's a socket example in some sdks using timer. Otherwise, the wiki is a good resource.

    I'd suggest you read some AO basics to help you understand how it works.

  6. #6
    Registered User
    Join Date
    Jun 2008
    Location
    India
    Posts
    1,048

    Re: E32USER-CBase 46 when call RSocket::Connect()

    I think going through the concepts of active object and asynchronous request would be better for you.

    1. You can't place multiple requests in a single objects consecutively.
    2. If there is an already pending request, you have to cancel it before placing a new one.
    3. Make two active objects if you want to place multiple asynchronous request simultaneously.

    to understand active object framework, you can try this useful link

    http://www.newlc.com/en/Symbian-Acti...amework-A.html

  7. #7
    Registered User
    Join Date
    Jun 2009
    Posts
    9

    Re: E32USER-CBase 46 when call RSocket::Connect()

    Thank you very much, I will read more about AO
    Đời vẽ tôi ... tên mục đồng

  8. #8
    Registered User
    Join Date
    Feb 2008
    Location
    India, Nashik
    Posts
    816

    Re: E32USER-CBase 46 when call RSocket::Connect()

    First of all you can use RTimer also secondly you need to avoid calling timers after function immediately after you issue the Socket request if that is happening then also it will generate stray signal

    you may structure your code in following way

    Code:
    RunL()
    {
       switch(..)
        {
           case ESockReadingDone:
             // Process the data
             // and generate issue timer wait event
             iTimer.After(iStatus,KEEP_ALIVE_DELAY);
    				iState = ESockReadingRepeat;
    				SetActive();
    				
    				break;
           case ESockReadingRepeat:
                   //.... read here by calling socket function
                   iState = ESockReadingDone;
                  SetActive();
        } 
    
    }
    Dont forget to check that for every async call you have setactive called if not you will be in trtouble.

  9. #9
    Regular Contributor
    Join Date
    Jul 2009
    Posts
    88

    Re: E32USER-CBase 46 when call RSocket::Connect()

    Let try to public your socket to internet and test again.
    I met this problem and I solved by that way.
    Best regards,

    Nguyend

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: E32USER-CBase 46 when call RSocket::Connect()

    This 2.5 years old issue was a traditional stray signal panic, due to re-use of CActive::iStatus:

    "iSocket.Connect(iAddress, iStatus);
    iState = EConnected;
    iTimer.After(iStatus, KTimeOut);//10 seconds"

    hopefully it has been fixed with CTimer or a separate custom active object for accommodating an RTimer.

Similar Threads

  1. Call Conferencing Issue.
    By aamitgupta in forum Symbian
    Replies: 5
    Last Post: 2009-06-12, 08:15
  2. Route outgoing call output to loudspeaker
    By negus in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2009-02-06, 09:06
  3. Replies: 9
    Last Post: 2009-02-06, 03:17
  4. E32User Cbase 21
    By Tina_Tibrewal in forum Symbian User Interface
    Replies: 3
    Last Post: 2006-10-05, 11:13
  5. Replies: 5
    Last Post: 2003-10-30, 14:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×