Delphi, How to get all local IPs?

in indy 9, there is a unit IdStack, with the class TIdStack

fStack := TIdStack.CreateStack;
try
  edit.caption := fStack.LocalAddress;  //the first address i believe
  ComboBox1.Items.Assign(fStack.LocalAddresses); //all the address'
finally
  freeandnil(fStack); 
end;

works great 🙂

from Remy Lebeau’s Comment

The same exists in Indy 10, but the
code is a little different:

TIdStack.IncUsage; 
try 
  GStack.AddLocalAddressesToList(ComboBox1.Items); 
  Edit.Caption := ComboBox1.Items[0]; 
finally 
  TIdStack.DecUsage; 
end; 

Leave a Comment