Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / March 2004

Tip: Looking for answers? Try searching our database.

get MAC ID of remote machine

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kumarforg - 12 Mar 2004 05:51 GMT
Hi

    how can one get the MAC address of a remote machine
        on an Ethernet LAN
    from a dotnet application ( without having a remote component on that machine
TI
regard
-Kumarforg
Chris Taylor - 13 Mar 2004 11:28 GMT
Hi,

One way would be to send a ARP request to the remote machine. You could
interop to the SendARP function in iphlpapi.dll.

[DllImport("iphlpapi.dll")]
public static extern int SendARP( int DestIP, int SrcIP, [Out] byte[]
pMacAddr, ref int PhyAddrLen );

IPAddress addr = IPAddress.Parse("192.168.0.1");
byte[] mac = new byte[6];
int len = mac.Length;
SendARP( (int)addr.Address, 0, mac, ref len );
string macAddress = BitConverter.ToString( mac, 0, len );

The Address propery of IPAddress is marked as obsolete, so you will get a
warning.

Hope this helps

Signature

Chris Taylor
http://dotnetjunkies.com/WebLog/chris.taylor/

> Hi,
>
[quoted text clipped - 4 lines]
> regards
> -Kumarforg

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.