RecvOneOrMore does not return KErrEof or KErrDisconnected
| Tue, 2007-04-24 02:06 | |
|
Hi all,
i have some (a little confusing) problems with sockets. I'm writing to receive data using RecvOneOrMore() from a Midlet (and send to server). I try to get data packet one after another, and i can get the first ones with no problem. But when the Midlet has sent all data and closed its socket, my programm doesn't come to RunL (with iStatus set to KErr...) but sticks at RecvOneOrMore() still waiting for incoming data. My code is: Code: void CTest::RequestData() { iBuffer.SetLength(0); iState = EDataReceivedFromMidlet; iBlankSocket.RecvOneOrMore(iBuffer, 0, iStatus, iLen); SetActive(); } void CTest::RunL() { switch(iStatus.Int()) { case KErrNone: switch(iState) { // Some initialization case EConnected: iLog.LogL(_L("Connected")); RequestData(); // Or iBlankSocket.RecvOneOrMore(iBuffer, 0, iStatus, iLen); break; case EDataReceivedFromMidlet: iLog.LogL(_L("Midlet data received")); PrintReceivedData(); RequestData(); // Or iBlankSocket.RecvOneOrMore(iBuffer, 0, iStatus, iLen); break; default: iLog.LogL(_L("State error")); } break; case KErrDisconnected: iLog.LogL(_L("Connection closed")); break; case KErrEof: iLog.LogL(_L("Connection ended")); break; default: iLog.LogL(_L("Status error")); } } I'd like to ask, does anyone has the same problem? Or could anyone tell me what's my problem? Thanks in advance! |
|





