Internet Direct (Indy) Version 9.0.1 Beta
TIdUDPBase.ReceiveBuffer
Reads data from a remote connection.

function ReceiveBuffer(var ABuffer; const ABufferSize: Integer; const AMSec: Integer): integer; overload;
function ReceiveBuffer(var ABuffer; const ABufferSize: Integer; var VPeerIP: string; var VPeerPort: integer; AMSec: Integer): integer; overload;
Parameters
var ABuffer
Buffer where received data is stored.

const ABufferSize: Integer
Number of bytes to read from the remote connection.

var VPeerIP: string
IP address for the remote connection.

var VPeerPort: integer
Port number for the remote connection.

AMSec: Integer = IdTimeoutDefault
Milliseconds to wait for a readable connection. The default value is IdTimeoutDefault.

Returns
Integer - Bytes read from the remote connection.

Description
ReceiveBuffer is an Integer function used to read data from the remote connection specified in VPeerIP and VPeerPort into the buffer ABuffer.

ABufferSize indicates the number of bytes to read from the remote connection.

AMSec indicates the number of milliseconds to delay while waiting for the socket Binding to become Readable. The default value for AMSec is IdTimeoutDefault, and indicates that ReceiveTimeOut will be used as the timeout value.

If a timeout occurs while waiting for the Binding to become ready for the read operation, RecvBuffer will set the following values before exiting the method:

If RecvBuffer is unable to read data from the remote connection, an EIdUDPReceiveErrorZeroBytes exception will be raised.