CSecureSocket->RecvOneOrMore
| Fri, 2008-05-09 10:30 | |
|
Hi, The buffer I’m passing to the method is always cleaned before calling the method, using FillZ() (and Zero()). If I’m using the Recv method instead, every thing works fine but if the input stream is not a multiple of the buffer I’m using for reading (512) the RunL method of my active object is never called since the buffer cannot be filled on the last read. I cannot use the Recv() method with 1 byte buffer because the scenario I'm facing force me to read more than 1 byte at a time (a timer is running). Does anyone have any tip on this? Cheers Francesco |
|






Forum posts: 150
Is this on emulator or on a phone?
That's strange. It would be interesting to see what's actually in the underlying TCP socket buffer. Just before you call RecvOneOrMore, you can check how much data is in the socket's q by using the KSoTcpReadBytesPending socket option. Inlcude and link against insock.lib.
// Assuming iSocket is an RSocket instance that you used to create the CSecureSocket instanceTInt bytesYetToBeRead = 0;
User::LeaveIfError(iSocket.GetOpt(KSoTcpReadBytesPending, KSolInetTcp, bytesYetToBeRead));
See what the value of bytesYetToBeRead is.
Can you please post the code you are using too?
Forum posts: 2
Hi,
thanks for your reply!
I'm currently working on an emulator. Everything seems to work fine on the server side. I already tried to use what you suggested to see if there is more than one byte buffered and the answer is positive
I tried to use the Recv method instead and it is working, I even used the RecvOneOrMore on the RSocket that is passed as a parameter to initialize the CsecureSocket and that is working too.
Could it be something related to some option I'm not setting?
Hope someone can help me with this.
Thanks a lot
Francesco