chillibear.com

IP addresses of the current machine

So how do you get a list of all the IP addresses bound to the local ethernet adapter? Easy use the built in global stack; GStack. All you need to do is add IdStack to your uses clause and your away!

uses
IdStack;

CheckListBox1.Clear;
CheckListBox1.Items := GStack.
LocalAddresses; CheckListBox1.Items.Insert(0, '127.0.0.1');

Note that I’ve added the local loopback address manually.

Written on 24 Dec 2008 and categorised in Delphi, tagged as IP and GStack

Home, Post archive

site copyright Eric Freeman

Valid XHTML 1.0 Strict