How do I get network info in Delphi
To get network information in Delphi, you can use the TNetworkAdapter class from the System.Net.AdapterInfo unit of the Delphi RTL. This class provides properties and methods that allow you to access various details about the network adapters installed on your computer, such as the adapter name, description, IP address, and MAC address.
Here is an example of how you can use the TNetworkAdapter class in Delphi to get network information
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
uses System.SysUtils, System.Net.AdapterInfo; var Adapter TNetworkAdapter; Adapters TNetworkAdapterList; begin Adapters = TNetworkAdapterList.Create; try Get the list of network adapters Adapters.Update; Iterate through the list of adapters for Adapter in Adapters do begin Writeln(‘Adapter Name ‘, Adapter.Name); Writeln(‘Adapter Description ‘, Adapter.Description); Writeln(‘Adapter IP Address ‘, Adapter.IPAddress); Writeln(‘Adapter MAC Address ‘, Adapter.MacAddress); end; finally Adapters.Free; end; |
Leave a Reply