What's the second MAC address!?

[code]
Dim n as NetworkInterface

n = System.GetNetworkInterface(0)
MsgBox n.MACAddress

n = System.GetNetworkInterface(1)
MsgBox n.MACAddress[/code]

Paste this code in a button and please enlighten me, what does the second path represent!

You have two different network interfaces (WiFi and Ethernet perhaps), so each of them has their own MAC address…

Ah!

Hmm… Of-course!
So!? If I use this in the software, the first one will ALWAYS work? I mean, if a computer, or any device, has only one connection with Internet?

This code will also work on hand held devices such as phones and similar?

Not too certain if the active connection is always the first one… Will let someone more knowledgable about this topic answer…

OK, please do!
Because I think it might be confusing for the coding if the MAC comes in different order.

Maybe a person connect with cable (KAT) at one place and WiFi at another?
Will this computer show different MAC address on the first position?

Just did a quick test.
The first one(my LAN connection) seems to be the same even if I change the order of my network interfaces.
Put my USB connected phone as number 1 and it shows its MAC adr. as the second one.
They seem to have a fixed order even if they are active or not.
Tested on OSX 10.10.1

I’m not sure it’s always the case though.

[code]Dim count As Integer
count = System.NetworkInterfaceCount

For i As Integer = 0 To count-1
Listbox1.AddRow(System.GetNetworkInterface(i).IPAddress, System.GetNetworkInterface(i).MACAddress)
Next[/code]

Looks like it only lists active interfaces.

[quote=162830:@Albin Kiland]Just did a quick test.
The first one(my LAN connection) seems to be the same even if I change the order of my network interfaces.
Put my USB connected phone as number 1 and it shows its MAC adr. as the second one.
They seem to have a fixed order even if they are active or not.
Tested on OSX 10.10.1

I’m not sure it’s always the case though.[/quote]
These may be enumerated when your app launches. Make sure you restart your test app every time you change configs.

That I did not do :confused:

http://documentation.xojo.com/index.php/NetworkInterface

Is there a way to get the computer name!?
If so, also in OS X and for Linux… would be desirable for me.

I can live with the MAC address, but the computer name would also be pleasant! At least out of the user experience! :slight_smile:

[quote=163561:@Jakob Krabbe]http://documentation.xojo.com/index.php/NetworkInterface

Is there a way to get the computer name!?
If so, also in OS X and for Linux… would be desirable for me.

I can live with the MAC address, but the computer name would also be pleasant! At least out of the user experience! :-)[/quote]

in some environments, the computer name changes with its IP address. Strange I know. I used to work in the Financial world, and my windows laptop (yeah I really really love windows - sarcasm), would change its hostname to match my IP address which was DHCP. It would be something like WIN10123009056 which matched Windows 10.123.9.56. So if you are going to tie a license or something to the hostname, be careful.

sb

[quote=163638:@scott boss]in some environments, the computer name changes with its IP address. Strange I know. I used to work in the Financial world, and my windows laptop (yeah I really really love windows - sarcasm), would change its hostname to match my IP address which was DHCP. It would be something like WIN10123009056 which matched Windows 10.123.9.56. So if you are going to tie a license or something to the hostname, be careful.

sb[/quote]

Use the Bios serial number instead. It is very easy to change the MAC address on the network card, if you tied the license to that.

Here some info:
For Windows: https://forum.xojo.com/4447-shell-issue/p1#p30972

Thank you!
Valuable input.

BIOS seem fancy… but really, my software is also aiming at the advertisement industry and that means Mac OS X…


I’m not connecting the license to the MAC address! It’s actually reverse! A user can see his MAC’s and if new MAC’s occur, then the info may be updated by other person!

It’s for security, yes, but not as you usually would think, actually reverse.

It means, one person can have many MAC addresses but at least, they come from the same person. That’s the thought!
Along with a neat user interface it can be quite powerful!
also, in reverse, a person into hacking see the problem, without even trying. Nothing works with incorrect or made-up MAC’s.


I imagine the majority of the users have workstations. MAC addresses shouldn’t vary… not by default. Actually, it’s easy for me to try, because I imagine the users will have a similar set-up as myself. So, if MAC’s works for me, it’s likely also working for the potential consultants.

In this moment, I don’t see the users will sit in a network with dynamic MAC addresses, as the financial institute.
However, how will I know!?!?!?!?
It’s the lottery. But also, if this solution is a bad solution, then I might skip it. Or, make it as an optional solution. Simply, the user himself can choose if updates shall rely on a static MAC address. :slight_smile:

Getting the Mac address for Windows. You might have a look at this one as well. Another way to do it, if it fails with Xojo System module. https://forum.xojo.com/19289-how-to-get-local-ip-addresses

Thank you.
I think of a different solution.
I think, most people have only ONE MAC address connecting from either home or office with the same device, the same computer.

It’s simple to check. If one person has more than 10 MAC addresses within a month, then this person is excluded from the fuzz of approving MAC addresses to update information.

Less than ten is still possible to manage, without too much effort.