×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    130

    Socket Disconnected on second attempt

    hi there...
    i'm sending data using RSocket from Sockets Example provided by symbian sdk.

    after engine state is EConnected, i send the data using

    iSocket.Write(aData,iTranStatus);
    User::WaitForRequest(iTranStatus);
    Read(); //start CSocketsReader AO to read response

    in CSocketsReader using RecvOneOrMore() and call SetActive until KErrEof.
    and then called iEngine->ResponseReceived() to parse the response..
    after parsing the response, i called a function that prepared the next data and called
    iSocket.Write(aData,iTranStatus);
    User::WaitForRequest(iTranStatus);

    the first operation is succeed adn iTranStatus is 0 (KErrNone)
    the last operation is failed and the iTranStatus is -36 (KErrDisconnected)
    i never called disconnect();

    do u know why is that happened? and how can i maintain a socket connection stay connected?
    i read from the documentation that RecvOneOrMore() function when receiving KErrEof, indicates that a remote connection is closed and that no more data is available for reading, or the socket has been shutdown with option EStopInput.

    is "that a remote connection is closed and that no more data is available for reading.." means that we cannot write again to remote server?

    really need help
    Thanks

    Rx-lee
    Last edited by Rx-lee; 2005-04-01 at 09:43.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    Luttenberg (Netherlands)
    Posts
    577

    Re: Socket Disconnected on second attempt

    Did you solve this? I am experiencing the similar problems.

    Rene
    Rene Heuven
    Inmote - Creative Smartphone Solutions
    Web: www.inmote.com
    E-mail: rene@inmote.com

  3. #3
    Registered User
    Join Date
    Jul 2005
    Location
    Bengaluru, India
    Posts
    747

    Re: Socket Disconnected on second attempt

    If you want two way socket communication simultaneously, then it's better to go for two AO's. One for receiving (Read()) and one for sending (Write()). Inside an AO it's not recommended to use the User::WaitForRequest(). Read this thread you'll get a light on it: Common mis-use and abuse of Symbian OS.

  4. #4
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    130

    Re: Socket Disconnected on second attempt

    to heuven,

    u can send again, by disconnecting the connection first and start to connect and write the data again.

    or as said by vin2ktalks by using 2 AO's

    -Rxlee

Posting Permissions

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