xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

INetRecvEndblock()

Reads one block of data until an end-of-block marker is detected.

Syntax

INetRecvEndblock( <pSocket>     , ;
                 [<cEndOfBlock>], ;
                [@<nBytesRead>] , ;
                 [<nMaxLength>] , ;
                 [<nIncrement>]   ) --> cBlock

Arguments

<pSocket>
This is a pointer to a socket as returned by INetConnect() or INetAccept().
<cEndOfBlock>
Optionally, a character string can be passed specifying the end-of-block marker. It defaults to the return value of INetCRLF().
<nBytesRead>
If passed by reference, this parameter is assigned the number of bytes actually read from the socket, including the trailing end-of-block characters. This is Len(cBlock)+Len(<cEndOfBlock>).
<nMaxLength>
This is a numeric value specifying the maximum number of bytes to read from the socket for detecting an end-of-block character sequence.
<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 end-of-block marker 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 end-of-block marker. If an error occurs, the return value is NIL and a socket error is set.

Description

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

Note:  if <cEndOfBlock> is omitted, INetRecvEndblock() works exactly like INetRecvLine().

Info

See also:INetAccept(), INetConnect(), INetErrorCode(), INetRecv(), INetRecvLine(), 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