Get MAC Address and IP number

Hi All,

Can we obtain de MAC Address and the IP number of the local machine use Indy Components? I want to get this information without using exclusive Windows functions. My problem is how to obtain this information on Mac OS X and iOS systems.

Thanks.
0
romulo
11/1/2011 11:39:25 AM
embarcadero.delphi.winsock 1874 articles. 2 followers. Follow

4 Replies
2879 Views

Similar Articles

[PageSpeed] 20

<romulo nascimento> wrote in message news:415847@forums.embarcadero.com...

> Can we obtain de MAC Address and the IP number
> of the local machine use Indy Components?

MAC, no.  MACs are not exposed in socket APIs.

IP(s), yes.  Use the LocalAddress and/or LocalAddresses properties, or the 
AddLocalAddressesToList() method, of the global "GStack: TIdStack" object in 
the IdStack unit, eg:

{code:delphi}
uses
  ..., IdStack;

LocalAddresses.Items.Assign(GStack.LocalAddresses);
{code}

{code:delphi}
uses
  ..., IdStack;

LocalAddresses.Items.Clear;
GStack.AddLocalAddressesToList(LocalAddresses.Items);
{code}

If you do not have any Indy components instantiated at the time you need to 
access the GStack object, you will have to call the TIdStack.IncUsage() and 
TIdStack.DecUsage() methods manually to ensure the object is available, eg:

{code:delphi}
uses
  ..., IdStack;

TIdStack.IncUsage;
try
  LocalAddresses.Items.Assign(GStack.LocalAddresses);
finally
  TIdStack.DecUsage;
end;
{code}

> I want to get this information without using exclusive Windows functions.

Sorry, but you have to use platform-specific APIs to get the MACs.

-- 
Remy Lebeau (TeamB)
0
Remy
11/1/2011 5:48:15 PM
> Sorry, but you have to use platform-specific APIs to get the MACs.
> 
> -- 
> Remy Lebeau (TeamB)

Thank you Remy for your answer, but, if I need to use platform-specific API to get MACs, what is the API to get this information in Mac OS X or iOS system? In Windows we have the NB30 unit to use, but NB30 don't exists in to Mac OS X? Any suggest?

Thanks again.
0
romulo
11/1/2011 6:14:59 PM
You could probably have the program run the ifconfig command line utility and parse the results. Here's the resulting ifconfig on my iMac (en0 is the ethernet):
{code}
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
        inet 127.0.0.1 netmask 0xff000000 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        ether 58:b0:35:fd:6f:75 
        inet6 fe80::5ab0:35ff:fefd:6f75%en0 prefixlen 64 scopeid 0x4 
        inet 216.120.82.46 netmask 0xffffffe0 broadcast 216.120.82.63
        media: autoselect (100baseTX <full-duplex,flow-control>)
        status: active
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
        lladdr d8:30:62:ff:fe:ff:6f:c8 
        media: autoselect <full-duplex>
        status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether d8:30:62:4d:be:eb 
        inet6 fe80::da30:62ff:fe4d:beeb%en1 prefixlen 64 scopeid 0x6 
        inet 192.168.0.165 netmask 0xffffff00 broadcast 192.168.0.255
        media: <unknown subtype>
        status: active
vnic0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 00:1c:42:00:00:08 
        inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
        media: autoselect
        status: active
vnic1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether 00:1c:42:00:00:09 
        inet 10.37.129.2 netmask 0xffffff00 broadcast 10.37.129.255
        media: autoselect
        status: active
{code}
0
Robert
11/1/2011 6:33:29 PM
<romulo nascimento> wrote in message news:415928@forums.embarcadero.com...

> what is the API to get this information in Mac OS X or iOS system?

I cannot answer that, asI do not develop for those platforms.

> In Windows we have the NB30 unit to use

I would use the GetAdaptersInfo() and GetAdaptersAddresses() functions 
instead.

-- 
Remy Lebeau (TeamB)
0
Remy
11/1/2011 9:38:31 PM
Reply:

Similar Artilces:

Get IP address and MAC address
Hi there! How can get ip address and mac address from command shell without root attributes(I can't use 'ifconfig'). Thank you in advance. -- [Adri�n C�rdoba] ------------------------------------------------------------------------ aecordoba wrote: > Hi there! > How can get ip address and mac address from command shell without root > attributes(I can't use 'ifconfig'). > Thank you in advance. > > /sbin/ifconfig -- Vahis aecordoba wrote: > Hi there! > How can get ip address and mac address from command shell wi...

How to get MAC address & IP address?
Dear all how to get the MAC address & IP address using PowerBuilder 6.5? thanks! Michael On Wed, 16 Jan 2002 22:42:51 +0800, "Michael" <michaell@hknet.com> wrote: >Dear all > > how to get the MAC address & IP address using PowerBuilder 6.5? > thanks! > >Michael > For IP address see http://eric.aling.tripod.com/PB/tips/pbtip14.htm -- Boris Gasin [TeamSybase] mailto:bgasin@dynamictechgroup.com Close to NJ? Join the NJ Sybase Tools User Group http://www.njpbug.org/njpbug/join/join.asp On Wed, ...

How to fix get IP-MAC pairs code below from Delphi 7 to Delphi 2009 ?
How to get All IP - MAC address pairs on local PC by Delphi 2009 ? The Code below can get correct answer on Delphi 7, but get error answer on Delphi 2009. How to fix ? or Are there the better method ? // Delphi 7 (Delphi 2009 failed) // // Get Alll IP-MAC address pairs on local PC // unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; function GetIPMAC: String; const ANY_SIZE = 1; MAX_ADAPTER_ADDRESS_LENGTH = 8; // arb. MAX_INTERFACE_NAME_LEN = 256; { mrapi.h } MAXL...

Getting the MAC Address, ISP IP, Client IP of the user and verifying it to let the Login
Hi Everyone,Any help for getting the IP address of the client, its MAC address and its ISP IP so that after checking these he will be let into login.RegardsSadeed Remember to click “Mark as Answer” on the post If you get answer from this post(s) !Thanks GuysRegardsSid  Is this over the LAN or over the internet?Over the internet, you can only get the apparent IP address of the user (which may be the address of the external router).As to getting the IP of the ISP, then closest might be do a traceroute and take the last but IP address. Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. Thanks for the reply............. I needed to get the MAC address of the client that is connected to the web application............. Also the IP Address of the client and both of these are required over the internet.......... Regards Sadeed  Remember to click “Mark as Answer” on the post If you get answer from this post(s) !Thanks GuysRegardsSid Hi, You can use the following... HttpContext.Current.Server.MachineName;//To get Machine Name HttpContext.Current.Request.UserHostAddress;// To Get IP Address      Read My Blogs  >I needed to get the MAC address of the client that is connected to the web applicationWithout running a script at the client end, you cannot get the MAC address over the i...

Getting MAC and TCP/IP addresses
Hi, Does anyone know how to determine the MAC address of an installed network interface card from within PowerBuilder? How about the current TCP/IP address? I think there are API calls for these items, but I can not seem to find them anywhere. Thanks for the help! Chris Street ctstreet@hydro.mb.ca In article <36EED522.65341440@hydro.mb.ca>, ctstreet@hydro.mb.ca says... > Hi, > > Does anyone know how to determine the MAC address of an installed > network interface card from within PowerBuilder? How about the current > TCP/IP address? > >...

Get Local IP Address with Delphi 2009
Hi all How can I get the local IP Address with Delphi 2009? All examples i find are only running with Delphi 2007 because they are not using AnsiChar. Thank you for your help Herbert > > All examples i find are only running with Delphi 2007 because they are not > using AnsiChar. Replace Char with AnsiChar in the examples ? I got this off the Internet and I have used it in several projects. I changed char to ansichar for Delphi 2009 and it works. This function uses the winsock unit. function TForm1.GETIPAddress(): string; type pu_long = ^u_long; var varTWSAData : TWSAData; varPHostEnt : PHostEnt; varTInAddr : TInAddr; namebuf : Array[0..255] of ansichar; begin try try If WSAStartup($101,varTWSAData) <> 0 Then Result := '' Else Begin gethostname(namebuf,sizeof(namebuf)); varPHostEnt := gethostbyname(namebuf); varTInAddr.S_addr := u_long(pu_long(varPHostEnt^.h_addr_list^)^); Result := inet_ntoa(varTInAddr); End; except Result := ''; end; finally WSACleanup; end; end; > How can I get the local IP Address with Delphi 2009? function LocalHostIP: string; begin result := '127.0.0.1'; end; <g> > {quote:title=Herbert Schlup wrote:}{quote} > Hi all > > How can I get the local IP Address with Delphi 2009? > > All examples i find are only running with Delp...

Getting MAC address or Serial number of Hard disk
Hi, I would like to track whether my client come back my site or not. Is it possible to get MAC address or Serial Number of hard disk of client PC accessing our site?ThanksTran Hong Quang There is no direct way of doing this in ASP.NET. However, you could use WMI in ASP.NET, and I beleive WMI can tell you that information.Cheers,       Kevin JonesMy Blog...

Ip addresses linked to MAC addresses?
Hi, I recently decided to install a router onto my internet connection, (partially because of my Shields Up results, and partially because my linux computer acting as a router was a bottleneck (ISA ethernet cards.. eww)) Anyway, I plugged it in, booted it up, and noticed that my IP address had changed. Now, nowhere in my internet access does it say anything about static IP address, but my IP address hadn't changed for quite some time. (Somewhere in the range of 1-2 years) I thought that this was too much of a coincidence, so I took a closer look at my LinkSys router, and saw a WAN ...

Is there a way to get IP/Host name given the MAC address?
------_=_NextPart_001_01C19DA2.7BFEE650 Content-Type: text/plain; charset="Windows-1255" > Hi, > > Does anybody know's a way to get a Host name > If I have a Mac address both in pc and sun? > (it's the same as RARP but I don't know how to do it using command line ) > > THX > > ------_=_NextPart_001_01C19DA2.7BFEE650-- 1. SUN without DNS: arp -a 2. SUN with DNS: arp -a; nslookup hostname For Example: % arp -a | grep '00:55:' Net to Media Table Device IP Address Mask Flags Phys Addr ------ -------------------- --------------- ----- --------------- hme0 notsoolate.foo.com 255.255.255.255 00:55:ab:78:89:cd hme0 tiger 255.255.255.255 00:55:af:78:89:gh % nslookup tiger Server: dnslion.foo.com Address: 192.168.0.254 Name: tiger.foo.com ---------------------------- 3. PC (WIN9X): winipcfg, then click on the "adapters" pull down menu, and select the Ethernet card. If the information is not enough, click on details. 4. PC (Others) ipconfig {/all} Try help on ipconfig and ifconfig __________________ William Ampeh (x3939) Federal Reserve Board ...

IP Address allocation by mac address
Is it possible to give a specific mac address a fixed IP address when it requests an address from the DHCP server? mike.dawson@scarborough.gov.uk schrieb: >Is it possible to give a specific mac address a fixed IP address when it >requests an address from the DHCP server? Yes. Just create an ip-address-object with manual assignment type in the DNS/DHCP management console. Enter the mac-address, unload and reload the dhcpsrvr module and release and renew the address at the workstation. Important: Don�t touch the client identifier field, when creating the object. J...

IP Number/ IP Address Array
I need to convert the first column of a list of IP numbers to IP addresses. I created an array of my list but am stumped on how to convert the numbers. File: 180884576 imstrmcs05 180884577 imstrmcs06 180884578 imstrmcs07 180884579 imstrmcs08 180884580 imstrmcs09 180884581 imstrmcs10 Script: # Properly formatting into an array open(IPLIST, "file") || die "couldn't open the file"; while ($x = <IPLIST>) { chop $x; @arr = split /\s+/,$x; print "@arr\n"; } # Converting IP number to IP address...

Find an IP address having only the MAC address
Hi again, I've been searching google for a while about this issue, but I'm still too confused. My goal is to discover the IP address of the LAN interface of a Cisco 1721 router (it's located at the office where I work). I know the MAC address because it's written in a sticker at the bottom of the router. But I don't know the password to the router admin console :( The router's LAN interface is connected to a Sun workstation that has two NICs (one of them connected to the cisco and the other connected to a 24- port switch). The Sun machine works as a...

IP address vs MAC address
Ok somebody explain this to me. I understand how IP addresses are issued(well sort of...lol) Is it one IP address to one MAC address?(not accounting for non routable IP space) I understand there can only be one WAN facing IP address per machine/MAC/NIC/etc realizing multiple NICs possible on one computer. If that is the case then how can say a Comcast DHCP server keep from issuing an IP to a MAC address that another provider has already issued an IP for? In this case perhaps someone has made up a MAC address to use in their router for cloning purposes. Or does it really ...

Virtual IP Address (Mac Addressing)
We are planning a 26node cluster Groupwise implementation early next year. After meeting with our Network people, one of them posed the question if Server A (connected to Switch A) fails over to Server B which is connected to Switch B (Will the virtual mac IP address that fails over to Server B be recorded correctly). I was under the impression that the application layer managed it, but we need clarification for Netware. Thanks. Novell's fail-over works by only moving the IP address of a resource and not the MAC address. Therefore, the fail-over is completely transparent ...

how to find ip address from mac address?
It happened more than once. At a customer's office, there is a device with an unknown ip address. We know its mac address. The ip address might be different from the network. For example, the customer's network might be 10.1.0.0/16, whereas that device might have the ip address 192.168.200.123/24. For example, it might be a managed switch that has kept its default ip address. So, it works as a switch, but I cannot manage it. Apart from a sniffer, is there a (free?) software that can scan the network and find ip addresses of all hosts, and/or only of those whose mac address ...

Could I use IdIPWatch to get "All" IP address by Delphi 2009 ?
Could I use IdIPWatch to get "All" IP address by Delphi 2009 ? ( IdIPWatch in Indy Misc palette) The code below only get one IP. Thank you very much . uses IdIPWatch; procedure TForm1.FormCreate(Sender: TObject); begin Memo1.Clear; Memo1.Lines.Add(IdIPWatch1.LocalIP); end; <ICST ICST> wrote in message news:113236@forums.codegear.com... > Could I use IdIPWatch to get "All" IP address by Delphi 2009 ? No. That is not what it is meant for. > The code below only get one IP. As it should be, because that is what TIdIPWatch is desi...

how to get remote device's MAC address by it's IP
HiAnyone knows how to get remote device's MAC address by it's IP, the remote devices are change every 5 minutes, I cannot count on ARP cache.Ben You might get a response in a different forum. this is for a project called "dotnetnuke"-DarrenNeese.com-DNN ROCKS!-DeveloperSchool.com...

How to get private ip address (intranet IP)
I found some webs at thailand taht can trace both the internet ip and the private ip address, (if user using intranet), of user who are interacting with web site. For Asp.NET . Are there some way to get a private ip address of user ? The link to web site that can traces private ip address http://www.pantip.com/tech/developer/topic/DN1701518/DN1701518.html ...

How to get IP address using Email Address
Hi, I want to know that how can i get actual IP address of a person who is using the email address like gmail, yahoo, msn, etc. If user enter the email address of the any person, it should return the actual IP Address of that person computer which is he connect. Is this possible? Any reference will be apperciated. Guide me............  This is not possible because email address is not related with IP address, Domain names are Mohamed Abb@s------------------------Please remember to click “Mark as Answer” on the post(s) which helps you ! Threre's no correlation between IP address and email addresses. So, it's impossible. HeartattacK: Threre's no correlation between IP address and email addresses. So, it's impossible.   Thanks HearattacK, Is there possiblity that when a user type any web url and that request come in my server. Can I get the IP of his/her PC? If yes how is it possible? For example if I type www.yahoo.com then can yahoo able to get my IP address. Where from the request made?    Yes you can track each user while visiting your websitesee these sites will help youhttp://www.google.com/analytics/ http://www.ewebcounter.com/  Mohamed Abb@s------------------------Please remember to click “Mark as Answer” on the post(s) which helps you ! bmwz9:  Yes you can track each user while visiting your website see these sites will help you http://www.google.com/analytics/ http://www.ewebcounte...

IP Number/ IP Address Array #2
Greetings, I need to convert the first column of a list of IP numbers to IP addresses. I created an array of my list but am stumped on how to convert the numbers. File: 180884576 imstrmcs05 180884577 imstrmcs06 180884578 imstrmcs07 180884579 imstrmcs08 180884580 imstrmcs09 180884581 imstrmcs10 Script: # Properly formatting into an array open(IPLIST, "file") || die "couldn't open the file"; while ($x = <IPLIST>) { chop $x; @arr = split /\s+/,$x; print "@arr\n"; } # Converting IP number...

ip address, mac address, agent name
Hi It seems that I was able to print a report showing IP Address, MAC address and Agent Name all on the same page...Did I make that up? Does anyone know how to do that? Thanks, Kat On Mar 15, 5:16 pm, mepr...@speakeasy.net wrote: > Hi > It seems that I was able to print a report showing IP Address, MAC address > and Agent Name all on the same page...Did I make that up? Does anyone know > how to do that? Well, the MAC address would really be tough as NDPS/iPrint has no need for the MAC address and as such does not record that information anywhere. If the pritner i...

How to get Hostname, IP address, port number, DB name, instance name using Query
As we know, normally we connect to a sybase server by just identifying the node name and interfaces file and necessary properties, but currently I want to get Host-name, IP address, port number, DB name, instance name of connected server out after connection created. Does any one how to use query to do so? Does sybase provide such functionality? Seems oracle can do so... If there is no query, does sybase provides any API which can implement this? Thanks! instance name: select @@servername [assumes the DBA has defined a local entry in syservers] db name: select db_name() [can be changed with 'use <database>'] ASE host/IP/port# : no way that I'm aware of unless you make a call out to the OS (eg, a shell script) via the XP server, though the external program/script would need to know which interfaces entry you originally accessed; this info could also be determined on the client side and then passed in with the connection (eg, isql's -H option, or as an initial ACF call as the first command once logged in}; must also take into consideration that there can be several 'query' entries in the interfaces file but you won't necessarily know which one your program used to connect to the ASE instance NOTE: ACF == Application Context Function; see set_appcontext(), get_appcontext() Keith wrote: > As we know, normally we connect to a sybase server by just > identifying the node name and interfaces file an...

get read obtain ip mac address name user pc name using vb 2008 and asp
these is the code for obtain ip, mac address, name pc, and user in a client side:Imports System.Net.NetworkInformationPartial Public Class _Default    Inherits System.Web.UI.Page    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, ByRef nsize As Integer) As Integer    Public Function GetUserName() As String        Dim iRturn As Integer        Dim username As String        userna...

Web resources about - Get MAC Address and IP number - embarcadero.delphi.winsock

IPv4 address exhaustion - Wikipedia, the free encyclopedia
IPv4 address exhaustion is the depletion of the pool of unallocated Internet Protocol Version 4 (IPv4) addresses. The IP address space is managed ...

Romney about to address GOP presidential race - Business Insider Deutschland
The former governor of Massachusetts and 2012 GOP presidential nominee will address the Hinckley Institute of Politics at the University of Utah. ...

Russell Reynolds Associates Launches The Center for Leadership Insight to Address the Most Vexing Boardroom ...
Russell Reynolds Associates, a leading executive search firm, today announced the launch of The Center for Leadership Insight, which has been ...

Romney said to attack `phony' Trump in Utah address on Thursday
Mitt Romney is set to lash out at Donald Trump in a bid to dislodge him from the top of the Republican party &amp;apos;s presidential nominating ...

Bill Maher Mocks Hypocrite 'Andrew Dice Trump' With Profanity-Laced SOTU Address
... Rules segment this Friday night: “The state of our union is f**king awesome”: Bill Maher mocks “Andrew Dice Trump” delivering the SOTU address ...

Sanders Campaign Staffers Admit Using False Address To Vote
Sanders Campaign Staffers Admit Using False Address To Vote

Weekly address: Obama is going to South by Southwest to salute tech innovation
... settle our differences and solve our collective challenges. And it’s only as good as we make it. President Obama discussed in his weekly address ...

'Outlander': Sam Heughan, Caitriona Balfe address those dating rumors - EW.com
It’s certainly not a stretch to assume Sam Heughan and Caitriona Balfe are an item in real life – their palpable, on-screen chemistry is one ...

GoPro Shells Out $105 Million For Two Video Editing Startups To Address Its Biggest Problem
GoPro Shells Out $105 Million For Two Video Editing Startups To Address Its Biggest Problem

West Virginia Judge to Address Hate-Crime Question in Case
A West Virginia judge says he plans to rule whether a former Marshall University football player accused of assaulting two gay men after he saw ...

Resources last updated: 3/7/2016 1:21:51 PM