×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    136

    SocketEngine example problem

    Hello,
    I have been trying to use the socket engine from SIP example code given into the SDK S60/ 9.1 /S60_3rd example code folder.
    I am successful to communicate data to my local server listener port using this example where I am using its contructL as
    Code:
    iState = ENotConnected;

    iConnectionSetupDone = EFalse;

    selectedIAP = 0;
    SelectAccessPointL(selectedIAP);//for selecting APN from list ...

    iTimer = CSIPExTimeOutTimer::NewL( *this );

    // Open channel to Socket Server
    User::LeaveIfError( iSocketServer.Connect() );

    TInetAddr::Cast(iNameRecord.iAddr).Output(ipAddr);
    addr.SetAddress(KInetAddr);
    ConnectL(selectedIAP,addr); //establish connection as client

    //StartListeningL(selectedIAP);

    iReader = CSIPExSocketReader::NewL( iDataSocket, *this );
    iWriter = CSIPExSocketWriter::NewL( iDataSocket, *this );


    where in ConnectL().. it is connected to server IP and then calls RUNL ()
    In RUNL()... Code goes into the switch case with iState EConnecting and writes the data once....
    Code:
    switch( iState )
    {
    case EConnecting:
    if( iStatus.Int() == KErrNone )
    {
    Log(_L8("\r\n In EConnecting KErrNone"));
    ChangeStateAndNotify( EConnected );

    Write(iBuf8);
    }
    else
    {
    Log(_L8("\r\n In EConnecting KErr"));
    ChangeStateAndNotify( ENotConnected );
    }
    break;

    till this , everything works oK.... and code comes to WriteDone method of SocketEngine after successful writing data on socket....
    void CSIPExSocketEngineWrite::WriteDone()
    {
    Log(_L8("\r\n In WriteDone()"));
    // Nothing to do
    Observer.WriteSuccess();
    }

    Now ... I have implemented the observer for this socketengine where after WriteDone() / or error occured state is communicated back to the AppUi...function .....
    Once data written complete... I want to again send a differnt packet data to the same server on same socket.... So I called Write methode of socket engine....which is something like as
    Code from SocketEngine:
    Write( const TDesC8& aTxt )
    {
    Log(_L8("\r\n In Write()"));
    if( iState == EConnected && !iWriter->IsActive() )
    {
    iWriter->Write( aTxt );
    }
    }


    As I called this method, apps exited with KERREXEC 3 .... I dint get any reason for this error here....
    Please guide... how can I call Write() method of SocketEngine from AppUi ...

    ( I am making sure 100%, the earlier write() call is over and Active obj of socketEngine is not called from anywhere else....)

    Any help regarding this is highly appreciated ...

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

    Re: SocketEngine example problem

    you should debug it and find the line that causes this panic. Basically you are trying to use invalid pointer, so it would help to see which variable it is.

  3. #3
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    136

    Re: SocketEngine example problem

    Thanks for quick reply
    I am getting this panic on line
    if( iState == EConnected && !iWriter->IsActive() )
    of
    Code:
    EXPORT_C void CSIPExSocketEngineWrite::Write( const TDesC8& aTxt )
    {
    Log(_L8("\r\n In Write()"));
    if( iState == EConnected && !iWriter->IsActive() )
    {
    Log(_L8("\r\n In Writing data on Socket"));
    iWriter->Write( aTxt );
    }
    }

    What might be cause

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

    Re: SocketEngine example problem

    So check how the iWriter is handled in your code, and that it is actually a valid pointer to a valid object.

  5. #5
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Re: SocketEngine example problem

    Yucca is right do one thing add a check like

    Code:
    if (iWriter)
    {
    .........
    }
    also check the first instaance where it becomes null.
    It might be null at the below line for some reason so debug ur code
    iWriter = CSIPExSocketWriter::NewL( iDataSocket, *this );
    check ur callstack and try to look at variable value at each step
    It will help u.

    Thanks

Similar Threads

  1. Problem with CAknDoubleStyleListBox with a CAknSearchField
    By jjig in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-09-17, 00:58
  2. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  3. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

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