473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how do I get the MAC Address given the IP

MMA
Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance

Aug 11 '06 #1
6 4601
Hello, MMA!

MAny ideas how can I get the MAC address of a PC outside my lan given the
MIP. I tried using iphlpapi.dll to call sendARP but dosen't work for
Moutside my lan.

You can use WMI
To connect to another computer, see example
( http://msdn2.microsoft.com/en-us/lib...mentscope.aspx )
To query for MAC address
( http://www.eggheadcafe.com/articles/20030511.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Aug 11 '06 #2
MMA wrote:
Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance
Short answer is: You can't do that easily. Why would you need MAC address?

You could:
use WMI to connect to computer and obtain that data. It may not work
because of firewalls, security reasons etc...
Implement some service on the remote side which will provide that
information

Regards,
Goran

Aug 11 '06 #3
MMA
Hi Vadym,

Does WMI allows me to talk outside my LAN. My research seems to indicate no.
Any ideas.

Thanks in advance

"Vadym Stetsyak" wrote:
Hello, MMA!

MAny ideas how can I get the MAC address of a PC outside my lan given the
MIP. I tried using iphlpapi.dll to call sendARP but dosen't work for
Moutside my lan.

You can use WMI
To connect to another computer, see example
( http://msdn2.microsoft.com/en-us/lib...mentscope.aspx )
To query for MAC address
( http://www.eggheadcafe.com/articles/20030511.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot
Aug 11 '06 #4
Hello, MMA!

MDoes WMI allows me to talk outside my LAN. My research seems to indicate
Mno. Any ideas.

Then as Goran Sliskovic mentioned you have to implement some service that will give you
host's MAC address.
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Aug 11 '06 #5
MMA wrote:
Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance
What would you do with the MAC address? Aside from that, are you really
expecting to see the MAC address of the computer that's accessing your
site/app? Because if they're using NAT you won't get to that. Concider
the following:

pc(192.168.0.1)-->router(external ip: 10.10.1.1)-->| WEB/VPN/whatever
|-->your router-->your server/pc

Now your server will only see the 10.10.1.1 address so when you're
actually able to get the associated MAC address, you'll only get the MAC
address of the router, not the PC.

ps. I know 10.10.x.x is an internal range, I just used it for
demonstrational purposes ;)
--
Rinze van Huizen
C-Services Holland b.v
Aug 15 '06 #6
MMA
Good point Rinze,

Something we have taken into account of, however because we are in somewhat
of a WAN, we are not most likely not going to be using NAT.

Thanks
"C-Services Holland b.v." wrote:
MMA wrote:
Hi All,

Any ideas how can I get the MAC address of a PC outside my lan given the IP.
I tried using iphlpapi.dll to call sendARP but dosen't work for outside my
lan.

Thanks in advance

What would you do with the MAC address? Aside from that, are you really
expecting to see the MAC address of the computer that's accessing your
site/app? Because if they're using NAT you won't get to that. Concider
the following:

pc(192.168.0.1)-->router(external ip: 10.10.1.1)-->| WEB/VPN/whatever
|-->your router-->your server/pc

Now your server will only see the 10.10.1.1 address so when you're
actually able to get the associated MAC address, you'll only get the MAC
address of the router, not the PC.

ps. I know 10.10.x.x is an internal range, I just used it for
demonstrational purposes ;)
--
Rinze van Huizen
C-Services Holland b.v
Aug 15 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: none | last post by:
I want to determine the outside (non local, a.k.a. 127.0.0.x) ip addresses of my host. It seems that the socket module provides me with some nifty tools for that but I cannot get it to work...
5
by: Gidraz | last post by:
Hello, i can't figure out how to retrieve clients MAC address using C#.NET. I can get IP but not MAC. Thanks in advance. Gidraz
117
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
29
by: chellappa | last post by:
hi all I need to write a program to find mac address of a my computer using libaries, is this possible? How? thanks
1
by: Uzi Baruch | last post by:
Hi! i want to know if i have an ip address of a computer and its DNS server name, if their is an windows API that can resolve the computer name of the given ip address. or vice verca -...
7
by: ashu | last post by:
look at code #include<stdio.h> int *mult(void); int main(void) { int *ptr,i; ptr=mult; for(i=0;i<6;i++) { printf("%d",*(ptr++));
57
by: Robert Seacord | last post by:
i am trying to print the address of a function without getting a compiler warning (i am compiling with gcc with alot of flags). if i try this: printf("%p", f); i get: warning: format %p...
17
by: Ben Bacarisse | last post by:
candide <toto@free.frwrites: These two statements are very different. The first one is just wrong and I am pretty sure you did not mean to suggest that. There is no object in C that is the...
7
by: John Koleszar | last post by:
Hi all, I'm porting some code that provides compile-time assertions from one compiler to another and ran across what I believe to be compliant code that won't compile using the new compiler. Not...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.