Hi,
I have a problem. Based on the value of some data already read in, I
want to receive some data via bluetooth. I set the amount of data read
dynamically like this:
HBufC8 *iReceiveData = HBufC8::NewL(iRecvSize);
And then I use RSocket::Recv method to receive data, like this:
TDes8 *Buf = &m_HBuf_ReceiveAckData->Des();
iSocket.Recv(*Buf, 0, iStatus);
SetActive();
If my data size to receive iRecvSize is not a multiple of 8, the
maximum length alocated for HBufC8 is multiple of 8, by design:
"It is important to note that the size of the allocated cell, and,
therefore, the resulting maximum length of the descriptor, may be
larger than requested due to the way memory is allocated in Symbian
OS. The amount by which this may be rounded up depends on the platform
and build type." (Symbian SDK)
But, RSocket::Recv is a little weird:
"For a stream-interfaced sockets, the function only completes when the
full amount of requested data has been received (or the connection
breaks). This means when the descriptor has been filled to its
__maximum__ length (__not its current length__). " (Symbian SDK)
So, if I send 3 bytes, Recv will expect 4 or 8 bytes.
I don't want to use RecvOneOrMore. What should I do?
Thank you.
Cristian Miron


|