I have three objects: SocketManager, SocketReader, and SocketWriter that are based on the Sockets example app and manage a single TCP connection over GPRS. I have no trouble when I instantiate one set of these objects to manage a 1st connection. But when I instantiate a second set to manage a 2nd simultaneous TCP connection, I am noticing some odd behavior:
When I have a RecvOneOrMore pending on the first connection and I call RecvOneOrMore on the second connection, the first connection immediately gets a KErrEof. If the first connection then retries its RecvOneOrMore, it gets KErrEof again, and so on for a total of 3 KErrEofs and then I get a KErrDisconnected. This is easily reproducable on the EPOC emulator. I have not yet tried it on the 3650 phone.
My Socket* objects do not share any data and have no static data or methods. As in the Sockets example, my SocketManager object has a RSocket object as a member (not a pointer to an RSocket), so I know that the 2 SocketManager objects are not sharing the same RSocket.
For now I am working around this by taking turns issuing reads to these 2 sockets, and luckily that is OK for my application. But this seems like a bug.
Is RSocket designed to have multiple independent instances, or is it designed to have only one instance?
It is funny, we have a similar problem...
We use 2 instances, too, but in our case, we handle two different connections at the same time. Or at least that is what we try, because when the second one connects, we receive a KErrCancel on the first one...