* Getting the MAC address of a client @ 2002-10-10 17:56 Lee Chin 2002-10-10 18:34 ` Glynn Clements 2002-10-10 18:51 ` Ray Olszewski 0 siblings, 2 replies; 3+ messages in thread From: Lee Chin @ 2002-10-10 17:56 UTC (permalink / raw) To: hahn; +Cc: linux-net, linux-newbie Hello, When my server application accepts a client socket connection, what is the easiest way to obtain the MAC address of the peer? I tried listing the ARP table but I did not see an entry for the IP address and MAC address of the client. I want to avoid having to ping the client to get the ARP table populated Thanks Lee -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup "Free price comparison tool gives you the best prices and cash back!" http://www.bestbuyfinder.com/download.htm - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Getting the MAC address of a client 2002-10-10 17:56 Getting the MAC address of a client Lee Chin @ 2002-10-10 18:34 ` Glynn Clements 2002-10-10 18:51 ` Ray Olszewski 1 sibling, 0 replies; 3+ messages in thread From: Glynn Clements @ 2002-10-10 18:34 UTC (permalink / raw) To: Lee Chin; +Cc: linux-net, linux-newbie Lee Chin wrote: > When my server application accepts a client socket connection, what is > the easiest way to obtain the MAC address of the peer? I tried listing > the ARP table but I did not see an entry for the IP address and MAC > address of the client. > > I want to avoid having to ping the client to get the ARP table populated If you don't see the client's MAC address in the ARP table, that probably means that the client isn't on the same physical (Ethernet) network as the server. In which case, there's no way that you can obtain its MAC address. BTW, pinging won't help in any case. If the client *does* happen to be on the same network as the server, the MAC address will have been retrieved in order to send the SYN+ACK. -- Glynn Clements <glynn.clements@virgin.net> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Getting the MAC address of a client 2002-10-10 17:56 Getting the MAC address of a client Lee Chin 2002-10-10 18:34 ` Glynn Clements @ 2002-10-10 18:51 ` Ray Olszewski 1 sibling, 0 replies; 3+ messages in thread From: Ray Olszewski @ 2002-10-10 18:51 UTC (permalink / raw) To: Lee Chin; +Cc: linux-newbie At 12:56 PM 10/10/02 -0500, Lee Chin wrote: >Hello, >When my server application accepts a client socket connection, what is the >easiest way to obtain the MAC address of the peer? I tried listing the >ARP table but I did not see an entry for the IP address and MAC address of >the client. >I want to avoid having to ping the client to get the ARP table populated The answer to your question depends on am omitted detail. If the "peer" IS on the same Ethernet as the server, its MAC address should be in the arp table once any packets have been exchanged between server and client. The only exception would be a server so active that it had to flush the arp table to make room for newer entries between the time it accepted the last packet and the time you checked the arp table. If it is not showing up, then you'll have to give us more details if we are to figure out why. If the "peer" is NOT on the same Ethernet as the server, there is no way (other than doing something in the application layer) to get its MAC address. MAC addresses are associated with the link layer (in this instance, the Ethernet frame), so do not cross routers (which operate at the network layer, in this instance, the IP datagram). In this case, just to be clear, ping'ing won't solve the problem. There is one other, intermediate case that I know of. If your "peer" is connected to the server through a LAN that proxy-arps its IP address, the server's arp table should include an entry that associates the IP address with the router's IP address. I doubt this applies to your case, but I mention it just for completeness' sake. There may be other rare cases similar to this one. -- -------------------------------------------"Never tell me the odds!"-------- Ray Olszewski -- Han Solo Palo Alto, California, USA ray@comarre.com ------------------------------------------------------------------------------- - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-10-10 18:51 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-10-10 17:56 Getting the MAC address of a client Lee Chin 2002-10-10 18:34 ` Glynn Clements 2002-10-10 18:51 ` Ray Olszewski
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.