Mythran wrote:
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in
message news:B9**********************************@microsof t.com... The MACAddress of a client is not transmitted via normal socket
operations,
unless you put in specific code on the client to retrieve and send this.
Peter
....
Interesting. I have seen on routers that run as DHCP servers obtain the
client's mac address/id. How do they do this when they don't have any
software installed on the clients machine? Maybe it's just sent when
the DHCP server hands out the address...otherwise, how would the router
know which computer is what? :)
I dunno, just wonderin'.
....
MAC address exists at lower level (protocol stack). Sockets deal with IP
addresses (usually). MAC address is only known at local area network
where broadcast can travel (on the same broadcast domain). IOW, socket
does not have to deal with MAC address, somebody else will resolve
proper MAC address if needed. That is done by ARP protocol (address
resolution protocol). It is part of standard TCP/IP protocol stack that
is installed on windows.
If you type "arp -a" at command prompt, you'll see cached MAC addresses
and it's mapping to IP addresses.
Routers don't need anything on client machine to get MAC address, as it
is contained in every packet received from client and it can be parsed.
Please not that if packet comes through router, it's MAC address will be
MAC address of routers interface, not remote client. Also, IP address
that you get from socket may not be IP address of client, it may be
changed by NAT. It is always bad idea to add logic based on IP address
you obtained from socket.
Regards,
Goran