How to get MAC address of a WLAN device?
Hi
I use windows vista as operating system and I use Nokia N900, and in my phone I activated WiFi utility and in my home I use WLAN for connecting my computer and my laptop and also I use to connect my mobile phone also now I want to get the all the network information of my mobile like get MAC address of a WLAN device and also know the IP address of my mobile device, I don’t if it’s possible or not please give me suggestion for that.
Re: How to get MAC address of a WLAN device?
Hey I give you best solution for that because I also face this same query for that I search lots of site then I got following code I tried on network and it will properly work and give perfect response to me.
Quote:
#include <in_sock.h>
LIBRARY insock.lib
RServrsockt servrsockt;
User::LeaveIfError(servrsockt.Connect());
CleanupClosePushL(servrsockt);
// Open a soktserv
RSoktserv soktserv;
User::LeaveIfError(soktserv.Open (servrsockt,KAfInet,KSockStream,KProtocolInetTcp));
CleanupClosePushL(soktserv);
// Start enumerating the interfaces
TPckgBuf<Intrfcdetail> info;
soktserv.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
TBuf<32> macadres;
while(soktserv.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info) == KErrNone)
{
if(info().iName.FindF(_L("Wlan")) == KErrNotFound)
continue;
macadres.Zero();
for(TUint i = sizeof(SSockAddr) ; i < sizeof(SSockAddr) + 6 ; i++)
if(i < (TUint)info().iHwAddr.Length())
macadres.AppendFormat(_L("%02X:"), info().iHwAddr[i] );
if(macadres.Length()) // remove trailing ':'
macadres.Delete(macadres.Length()-1, 1);
}
CleanupStack::PopAndDestroy(2);
Re: How to get MAC address of a WLAN device?
In Windows you get the winipcfg utility, using this utility you able to displays the computer's MAC address. And ipconfig utility will you can use in currently latest version of windows operating system. Using both 'winipcfg' and 'ipconfig' of windows utility may you able to display multiple MAC addresses for one computer. In windows at one computer you get only one MAC address which computer installed network card.
Re: How to get MAC address of a WLAN device?
you get the MAC address using IP address also for that you have to send one packet in the network with the help of IP address, if you want to know the MAC address of your WLAN then you have to know the IP address of receivers or those device which device you want to know the MAC address, for that you have to do one thing send broadcast the packet in network with receivers IP address, after some some time you get the response or you get the acknowledgment from this computer and with this acknowledgment you get the MAC address of this computer, use this solution and I sure this solution will definitely help you.
Re: How to get MAC address of a WLAN device?
I think for knowing the MAC address of WLAN device then you have to take help of ipconfig, using this command line utility, this utility available on all versions of Microsoft Windows. This utility design for run on the Windows command prompt and using this utility you able to get the IP address information of a Windows computer and using IP address you easily find out the MAC address of you WLAN device. It also allows some control over active TCP/IP connections. ipconfig is an alternative to the older 'winipcfg' utility.