Topic Path: Symbol Reference > Classes > TIdIPAddress Class > TIdIPAddress Methods > CompareAddress Method
ContentsIndexHome
PreviousUpNext
TIdIPAddress.CompareAddress Method

Compares the current IP address to a specifed value.

function CompareAddress(
    const AIP: String; 
    var Err: Boolean
): Integer;
Parameters 
Description 
AIP 
IP address to compare to the object instance.
 
Err 
Indicates an error when tryng to compare IPv4 and IPv6 addresses. 

Integer - 0 when the IP addresses are the same.

CompareAddress is an Integer function used to compare the current value of the IP address to the IP address indicated in AIP. CompareAddress uses the Cardinal value (for IPv4) or the Word value (for IPv6) for the IP addresses when performing the comparision. 

The return value for the function indicates the following: 

 

Value Meaning 
 

---- -----------------------------------------------------

 

0 Current IP address is the same as the indicated IP. 
>0 Current IP address is greater than the indicated IP. 
<0 Current IP address is less than the indicated IP. 

 

The IP address for the comparision must have the same TIdIPVersion value, or the value in Err is set to True. Please note that the return value in this circumstance is still 0 (zero).

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