|
|
|
date: Wed, 15 Aug 2007 12:07:48 -0400,
group: microsoft.public.platformsdk.networking
back
Re: How to get remote MAC
"Ben Voigt [C++ MVP]" <rbv@nospam.nospam> wrote in message
news:eXsm19A4HHA.4584@TK2MSFTNGP03.phx.gbl...
>
> "AndyW" wrote in message
> news:%23K4qTY13HHA.5980@TK2MSFTNGP04.phx.gbl...
>> Is there any way to get the MAC address associated with a socket? I know
>> SendARP can be used to get the MAC address associated with an IP address,
>> but what will it return if multiple clients are using the same IP
>> address? I need to be able to uniquely identify the client in this case,
>> is there something besides the MAC that would be unique?
>
> Sockets are associated to (sender IP, dest IP, sender port, dest port)
> tuple. If you have multiple clients using the same IP address (that's
> called a conflict!) then winsock will see only one connection and
> everything will be badly confused.
>
>>
>> Thanks in advance,
>> Andy
>>
>
>
I understand that, but there is nothing preventing someone from doing
something stupid (like using hte same IP address on 2 systems). On the
otherhand, it is difficult and uncommon to modify the MAC address, which is
why I would like to get it. I suppose an alternate question would be is
there a way to get the MAC address associated with a specific IP address and
port? It looks like SendARP only uses the IP address, which I assume will
return the MAC of the last system that it saw with the given IP address, so
all bets are off if 2 systems are using hte same address.
date: Thu, 16 Aug 2007 15:20:20 -0400
author: AndyW
Re: How to get remote MAC
> I understand that, but there is nothing preventing someone from doing
> something stupid (like using hte same IP address on 2 systems). On the
> otherhand, it is difficult and uncommon to modify the MAC address, which
> is why I would like to get it. I suppose an alternate question would be
> is there a way to get the MAC address associated with a specific IP
> address and port? It looks like SendARP only uses the IP address, which I
> assume will return the MAC of the last system that it saw with the given
> IP address, so all bets are off if 2 systems are using hte same address.
The ARP table holds the mapping from IP address to MAC address. The port
isn't considered at all. You can "lock" the mapping by creating a static
entry in the ARP table, then no matter who else uses that IP address, your
system will ignore them.
BTW it is not at all difficult to modify the MAC address, Windows has a
textbox for it in the Network Adapter configuration on the Advanced tab
(with most cards, a few drivers don't support it).
date: Mon, 10 Sep 2007 19:54:46 -0500
author: Ben Voigt [C++ MVP] am
|
|