xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

INetRecvLine()

Reads one line of data until CRLF is detected.

Syntax

INetRecvLine( <pSocket>    , ;
            [@<nBytesRead>], ;
            [<nMaxLength>] , ;
            [<nIncrement>]   ) --> cLine

Arguments

<pSocket>
This is a pointer to a socket as returned by INetConnect() or INetAccept().
<nBytesRead>
If passed by reference, this parameter is assigned the number of bytes actually read from the socket, including the trailing new-line characters. This is Len(cLine)+2.
<nMaxLength>
This is a numeric value specifying the maximum number of bytes to read from the socket for detecting a new-line character pair (CRLF).
<nIncrement>
This is an optional numeric value specifying the number of bytes to increment memory allocation while the function reads data from <pSocket> and no CRLF has arrived. By default, memory allocation is increased in steps of 80 bytes.

Return

The function returns a character string read from the socket without trailing new-line characters (CRLF). If an error occurs, the return value is NIL and a socket error is set.

Description

INetRecvLine() blocks the current thread until a new-line character sequence is read from <pSocket>. Since it is unknown how many data arrives before CRLF, the function incrementally increases memory allocation by <nIncrement> bytes until CRLF is detected, or until <nMaxLength> bytes are read. When no CRLF is detected, or when the socket is prematurely closed, the function returns NIL.

Info

See also:INetAccept(), INetConnect(), INetErrorCode(), INetRecv(), INetRecvEndBlock(), INetSend(), INetSendAll()
Category: Internet functions , Sockets functions , xHarbour extensions
Source:vm\INet.c
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe