xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

INetDataReady()

Tests if incoming data is available to be read.

Syntax

INetDataReady( <pSocket> , [<nMilliSecs>] ) --> nResult

Arguments

<pSocket>
This is a pointer to a socket as returned by INetConnect() or INetAccept().
<nMilliSecs>
If specified, this is a numeric value indicating the maximum number of milli seconds to wait until incoming data is detected.

Return

The function returns 1 if incoming data on <pSocket> is detected, or 0 if no data is available. When a network error occurs, the return value is -1.

Description

Function INetDataReady() is used to detect if data is available to be read from <pSocket> without blocking program execution. If <nMillisecs> is not specified, the function returns immediately 1 when there is some data to be read. It returns 0, if there is no data, and -1 in case of error. If <nMillisecs> is given, the functon waits for this amount of time for incoming data. If some data arrives during that period of time, the wait state is immediately terminated and the function returns 1.

If incoming data is detected, a subsequent call to InetRecv() will read available data, up to the requested length, without blocking program execution.

If an error occurs, InetErrorCode() can be used to determine the cause of failure.

Info

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