Topic Path: Symbol Reference > Classes > TIdStackDotNet Class > TIdStackDotNet Methods > ReceiveFrom Method
ContentsIndexHome
PreviousUpNext
TIdStackDotNet.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;
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 overridden Integer function that implements the method used to access the RecvFrom() API for the 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 creates an IPEndPoint used to access the IP address and port number for the remote network connection. 

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. 

Exceptions occuring in the method are re-raised using either the EIdSocketError or EIdWrapperException exception types.

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