Read from a socket
HB_INETRECV( <socket>, @<cResult>, [ <nAmount> ] ) -> nResult
<socket> a socket previously created / opened
<cResult> is the target buffer and must be passed by reference
<nAmount> is the upper limit of characters to be read from the socket. If not passed this defaults to the length of cResult
The number of the characters read from the socket.
Reads from the socket into a buffer.
The parameter cString must be preallocated so that it has enough space to receive the data. The routine will block the thread until some bytes are read from the socket, the socket is closed (either from the receiver or the sender side) or a network error occurs, whichever comes first. In the latter cases, an error is set, and only the characters received until premature end of communications are returned.
Notice that there is no guarantee that all the available bytes will be read before the function returns, in fact, hb_InetRecv returns as soon it is able to fill cString with one or more bytes. To block the current process until the whole cString is filled (or nAmount bytes are read), use the hb_InetRecvALL().