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
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?