Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 15 Aug 2007 12:07:48 -0400,    group: microsoft.public.platformsdk.networking        back       


How to get remote MAC   
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?

Thanks in advance,
Andy
date: Wed, 15 Aug 2007 12:07:48 -0400   author:   AndyW

Re: How to get remote MAC   
I dont think that is good idea. It will work if all of your client is
situated in the same subnet, else you get gateway's MAC address.
date: Thu, 16 Aug 2007 09:27:17 -0000   author:   TarasCo

Re: How to get remote MAC   
"TarasCo"  wrote in message 
news:1187256437.663766.159770@w3g2000hsg.googlegroups.com...
>I dont think that is good idea. It will work if all of your client is
> situated in the same subnet, else you get gateway's MAC address.
>

The clients are all on the same subnet
date: Thu, 16 Aug 2007 08:15:46 -0400   author:   AndyW

Re: How to get remote MAC   
"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
>
date: Thu, 16 Aug 2007 09:12:02 -0500   author:   Ben Voigt [C++ MVP] am

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

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us