Topic Path: Symbol Reference > Classes > TIdStack Class > TIdStack Methods > ReceiveFrom Method
ContentsIndexHome
PreviousUpNext
TIdStack.ReceiveFrom Method

Receives a datagram using a socket handle and stores the source address.

function ReceiveFrom(
    ASocket: TIdStackSocketHandle; 
    var VBuffer: TIdBytes; 
    var VIP: string; 
    var VPort: Integer; 
    const AIPVersion: TIdIPVersion = ID_DEFAULT_IP_VERSION
): Integer; virtual; abstract;
Parameters 
Description 
ASocket 
Socket handle for the operation.
 
VIP 
IP address for the remote network.
 
VPort 
Port number for the remote network.
 
AIPVersion 
IP address family for the IP address. 
ABuffer 
Buffer used to store values read from the socket handle.
 

Integer - Number of bytes read from the socket handle.

ReceiveFrom is an abstract virtual Integer function that specifies the method used to access the RecvFrom() API for a protocol stack implementation. 

ReceiveFrom reads data from the socket handle in ASocket, and stores the remote destination IP address and port number in VIP and VPort. Byte values read from the socket are stored in the ABuffer argument. 

The return value for the method is the number of bytes read from the socket handle, or 0 (zero) when the connection has been closed gracefully. 

AIPVersion indicates the IP address family supported for transmission on the socket handle. 

ReceiveFrom must be overriddden and implemented in a descendant class that provides access to the protocol stack for the platform or operating system hosting the Indy library. 

Use ReceiveMsg to capture data for message-oriented datagram transmissions using UDP or IP multicast.

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