×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    40

    Error for reading Data from socket

    Hi All,

    I am trying to create a socket to raed a chunk of data from the server side.When working on emulator i am able to get the data..but using device it is giving error. I am able to connect
    to the socket and after that only i am requesting the data..
    i am using iSocket.RecvOneOrMore() for getting the data..

    Can anyone please guide what is the problem?

    Thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: Error for reading Data from socket

    What error do you get?

    Also it would be great if you could provide a code snippet illustrating how you are establishing a connection.
    Regards,
    ivey

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    40

    Re: Error for reading Data from socket

    the application is getting exited..

    i am using this for receiving the data
    iSocket.RecvOneOrMore( iBuffer, 0, iStatus, iDummyLength );

    and this code for connection

    TInetAddr addr;
    ConnectL( addr.Address() );

    I am giving appropriate IP address..and have checked that the connection is happening...but only when i try to raed data it is crashing.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,698

    Re: Error for reading Data from socket


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

    Re: Error for reading Data from socket

    With that little bit of info is hard to say. Post at least the lines surrounding your recv call.. and check if you get any panic..

  6. #6
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: Error for reading Data from socket

    Quote Originally Posted by rati2010 View Post
    the application is getting exited..
    Your application panics. Please refer to this article on how to get the panic details: Extended panic code.
    Regards,
    ivey

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    40

    Re: Error for reading Data from socket

    void CReader::RunL()
    {
    RFs rfs;
    RFile aFile ;
    TBuf8<51200> aCon;
    CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    note->ExecuteLD(_L("RunL")); // Have to be removed
    // Active object request complete handler
    switch ( iStatus.Int() )
    {
    case KErrNone:
    iEngineNotifier.ResponseReceived( iBuffer );
    aCon.Copy(iBuffer);
    TInt err;
    User::LeaveIfError(rfs.Connect());
    err = aFile.Open(rfs,KPath1,EFileWrite);
    if(err != KErrNone)
    err = aFile.Create(rfs,KPath1,EFileWrite);//EFileShareReadersOrWriters);
    if(KErrNone == err)
    {
    int pos = 0;
    aFile.Size(pos);
    aFile.Seek(ESeekStart,pos);
    err = aFile.Write( aCon);
    }
    aFile.Close();
    rfs.Close();

    break;
    case KErrDisconnected:
    iEngineNotifier.ReportError( Notifier::EDisconnected,
    iStatus.Int() );
    break;
    default:
    iEngineNotifier.ReportError( Notifier::EGeneralReadError,
    iStatus.Int() );
    break;
    }
    }



    void CReader::IssueRead()
    {
    CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    note->ExecuteLD(_L("IssueRead")); // Have to be removed
    // Initiate a new read from socket into iBuffer
    __ASSERT_ALWAYS( !IsActive(), User::Panic( KPanicEngineRead,
    ESocketsBadState ) );
    iSocket.RecvOneOrMore( iBuffer, 0, iStatus, iDummyLength );
    SetActive();
    }




    After IssueRead() (it enters IssueRead function() called from soem other function and i am able to see the information note on entering the IssueRead()),the application exits and shows KernEXec3.. which we are getting when we manually exit the application on the emulator...otherwise it works fine on emulator.
    -

  8. #8
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: Error for reading Data from socket

    Quote Originally Posted by rati2010 View Post
    void CReader::RunL()
    {
    RFs rfs;
    RFile aFile ;
    TBuf8<51200> aCon;
    CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
    note->ExecuteLD(_L("RunL")); // Have to be removed
    // Active object request complete handler
    Well, to begin with you can make the aCon buffer not so large (1 kB or less) or allocate this memory on heap. You are definitely running out of stack here.
    Regards,
    ivey

  9. #9
    Registered User
    Join Date
    Jun 2008
    Posts
    40

    Re: Error for reading Data from socket

    Thanks a lot.. On reducing the size it is working ...

  10. #10
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: Error for reading Data from socket

    Great!

    To avoid such issues in future the following article may be useful for you:
    Emulator/native platform differences
    Regards,
    ivey

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,698

    Re: Error for reading Data from socket

    In fact iBuffer is already a 8-bit descriptor, you can write it directly to the file.

Similar Threads

  1. DATA STREAM from socket to bluetooth
    By mariobid in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2007-07-15, 06:17
  2. Closing bluetooth socket AFTER all data has been sent
    By tumppi in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-07-09, 13:28
  3. Read from a secure socket always returns data
    By barnabyg in forum Mobile Java General
    Replies: 1
    Last Post: 2006-07-02, 20:30
  4. Nokia 6600 Socket Server send delay Problem
    By dicson_hu in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-31, 07:37

Posting Permissions

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