Read a line from a socket


      HB_INETRECVLINE( <socket> [, @<nBytesRead>, [, <nMaxLength> ;
                       [, <nBufSize> ]]] ) -> cResult


<socket> a socket previously created / opened

<nBytesRead> must be passed by reference




Line read


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).



3 responses to “hb_inetRecvLine()

  1. Pingback: Harbour All Functions – H | Viva Clipper !

  2. Pingback: Harbour inet Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.