There are a number of RSocket
functions that allow you to read from a socket:
Recv()
and Read()
only complete when the full
amount of requested data has been received (or the connection breaks).
The amount of data requested means the maximum length (rather than the current length) of the descriptor receiving the data. In some circumstances, you will want to set the amount of data read dynamically (for example, based on the value of some data already read in). The simplest way to do this is to use an HBufC8
-type descriptor, which can have its maximum length set at run-time.
RecvOneOrMore()
reads at least one byte of data, but will
complete as soon as any data is available. The amount of data received is
returned via the TSockXfrLength
argument.
RecvFrom()
should be used on unconnected sockets where a
source address is returned.
Recv()
, Read()
, andRecvOneOrMore()
should only be used with connected sockets.