Topic Path: Symbol Reference > Classes > TIdStackBSDBase Class > TIdStackBSDBase Methods > ReceiveFrom Method
TIdStackBSDBase.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; override;
Socket handle for the operation.
IP address for the remote network.
Port number for the remote network.
IP address family for the IP address. 
Buffer used to store values read from the socket handle.

Integer - Number of bytes read from the socket handle.

ReceiveFrom is an overridden Integer function that implements 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. 

ReceiveFrom checks for a socket error during the operation, and sets the return value to True when no socket error is detected. 

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

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