Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Aug 2003


    Hi all,

    I have a simple (I hope) socket question.
    I use the following piece of code to accept an incoming connection:

    //A struct with a socket
    struct channel {
    RSocket * socket;
    } ch;

    RSocket * acceptingSocket;
    TRequestStatus status;

    acceptingSocket->Accept(*(ch->socket), status);

    So the 'ch->socket' gets connected after the last call (indeed this is what happens).
    I then pass the 'ch' variable to a Read method in order to perform some read operation on the socket.
    The signature of the method is:

    int Read(struct channel * ch, int size);

    The problem is that inside the Read method (where ch->socket->Read() is called) the socket gets disconnected.
    In other words the ch->socket->Read(..) method ends with a status of KErrDisconnected.

    If I use the Read method immediately after the
    acceptingSocket->Accept(ch->socket, status);
    call, and in the same method (not in the Read() method) no problem arises.

    Why does this happen? It's as if the socket doesn't get passed correctly in the method. Does anyone have a clue?

    Last edited by vasilak; 2003-08-27 at 15:48.

Posting Permissions

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