Topic Path: Symbol Reference > Classes > TIdUDPClient Class > TIdUDPClient Methods > ReceiveBuffer Method > ReceiveBuffer Method (TIdBytes, string, integer, TIdIPVersion, Integer)
TIdUDPClient.ReceiveBuffer Method (TIdBytes, string, integer, TIdIPVersion, Integer)

Reads a UDP datagram from the remote peer.

function ReceiveBuffer(
    var ABuffer: TIdBytes; 
    var VPeerIP: string; 
    var VPeerPort: integer; 
    const AIPVersion: TIdIPVersion = ID_DEFAULT_IP_VERSION; 
    const AMSec: Integer = IdTimeoutDefault
): integer; override; overload;
Values read from a UDP datagram.
IP address for the remote peer.
Port number for the remote peer.
IP address family for the datagram transmission. Default value is ID_DEFAULT_IP_VERSION.
Time to wait for successful receipt of the datagram. Default value is IdTimeoutDefault

Integer - Number of bytes received in the UDP datagram.

ReceiveBuffer is an overloaded overridden method integer function used to read a datagram from a remote connection into the buffer specified in ABuffer. 

VPeerIP is the IP address for the remote peer sending the datagram transmission. 

VPeerPort is Port number for the remote peer sending the datagram transmission. 

VPeerIP and VPeerPort are updated when data is read from the remote peer using the Binding for the client. On successful completion of the receive operation, VPeerIP and VPeerPort will contain the IP address and port number of the remote connection that is the origin for the data in ABuffer. 

AIPVersion indicates the IP address family for the datagram transmission. The default value is ID_DEFAULT_IP_VERSION

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

If a timeout occurs while waiting for the Binding to become ready for the read operation, ReceiveBuffer will set the return value for the method to 0 (zero). In addition, the following values will be set before exiting the method: 


'' (empty string) 
0 (zero) 


ReceiveBuffer is overridden to provide support for reading the datagram from a proxied connection using the TransparentProxy for the client (when assigned). 

ReceiveBuffer will raise an EIdMustUseOpenProxy exception if the method is used prior to calling the OpenProxy method.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.