xHarbour Reference Documentation > Function Reference |
Reads data from a datagram socket.
INetDGramRecv( <pSocket>, ; @<cBuffer>, ; [<nBytes>] ) --> nReceivedBytes
The function returns a numeric value indicating the number of bytes read from the socket. If the return value is smaller than Len(<cBuffer>), either no more bytes are available, or a network error ocurred. This can be identified using function INetErrorCode().
INetDGramRecv() blocks the current thread until <nBytes> bytes are read from a datagram socket <pSocket>. The received bytes are copied into the memory variable <cBuffer>, which must be passed by reference.
To avoid blocking, function INetDataReady() can be used to detect if incoming data is available, or a timeout value can be set with INetSetTimeout().
Note: it is not guaranteed that all the data required to be read is sent from the kernel to the application. The kernel just returns the last complete datagram that has been received, up to <nBytes> bytes.
Refer to function INetDGramSend() for an example of datagram exchange between two processes.
See also: | INetDGram(), INetDGramBind(), INetDGramSend(), INetSetTimeout() |
Category: | Datagram functions , Sockets functions , xHarbour extensions |
Source: | vm\INet.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
http://www.xHarbour.com