MAC address - can you get it?

Monkey Forums/Monkey Programming/MAC address - can you get it?

Leon Brown(Posted 2012) [#1]
Is it possible to get the MAC address of the computer with Monkey? I'm specifically interested in this for Android, but other platforms will be handy later.


DruggedBunny(Posted 2012) [#2]
Monkey definitely won't provide this in any way, but I've dabbled in Win32 IP/network adapter stuff before via PureBasic, and this PB code will show the MAC address of the PC it's run on -- very Win32-specific!



However, this is a more platform-neutral MAC-getter, again in PB, I believe by a guy by the name of Flype:

Procedure.s GetMacAddr(IP.s) 
  n.l = 6
  Dim MacAddr.b(n)
  If SendARP_(inet_addr_(IP), 0, @MacAddr(0), @n) = #NO_ERROR 
    For i = 0 To n - 2
      MAC$ + RSet(Hex(MacAddr(i)&255),2,"0") + ":"
    Next
    ProcedureReturn MAC$ + RSet(Hex(MacAddr(i)&255),2,"0")
  EndIf
EndProcedure 


I believe a SendARP-like function is available on most platforms that support TCP/IP, and inet_addr converts a string-IP ("192.168.0.1") to an integer, also available in some way on most platforms.

Anyway, although I can't help directly, perhaps this might help point you in the right direction...


Arthur(Posted 2012) [#3]
Is there any way to get MAC address of the WiFi point which is used to connect to Internet from iOS device?