HB_INETRECVLINE()
Read a line from a socket
Syntax
HB_INETRECVLINE( <socket> [, @<nBytesRead>, [, <nMaxLength> ; [, <nBufSize> ]]] ) -> cResult
Arguments
<socket> a socket previously created / opened
<nBytesRead> must be passed by reference
<nMaxLength>
<nBufSize>
Returns
Line read
Description
Blocks the calling thread until a sequence CRLF is read from the socket. Incremental allocation and end-of-line checking are done in an efficient way.
If an error occurs, or if the stream is closed before a CRLF is read, the function returns nothing and sets the socket error.
The returned string does not contain the trailing CRLF sequence, so an empty line is effectively returned as an empty string.
If the nBytesRead parameter is given, it will contain the number of bytes read from the socket, including the CRLF sequence, so that in normal conditions, nResult will report a count equal to the length of the returned string plus 2. nBytesRead will be 0 if stream is closed before a CRLF sequence is read, and will be -1 on error.
An optional nMaxLength parameter can be given to allow a maximum character count before the data is returned anyway. If this number is reached before a CRLF sequence is encountered, nBytesRead will contain the value one.
Finally, a nBufSize parameter can be given. If not, memory allocation will be increased by discrete amounts of 80 bytes. The programmer can provide here a different allocation strategy (e.g. setting nBufSize equal to nMaxLength, memory for reading the line will be allocated only once, at the beginning of the function).
Compliance
Harbour
Pingback: Harbour All Functions – H | Viva Clipper !
Pingback: Harbour inet Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !