NIC adress of incoming socket.

Peter Hansen peter at engcorp.com
Sat May 15 00:10:28 EDT 2004


RosalieM wrote:

> How can i know the nic adress from an incoming socket ?
> I can easily know the ip adress and port number but how do i have some
> information about arp level ?

In addition to Andreas' answer: I'm not even sure the problem
has a well-defined solution in general.  Isn't it possible
that individual packets in the data stream (assuming this
is TCP, for example) can be routed through different
networks (and, therefore, different NICs) on some machines?

If you want to limit this to the simple case of one NIC
per machine, then you still need to resort to platform-specific
things like parsing the output of some external command
to match up IP address and "NIC address" (which is also
not necessarily well-defined, but I assume you mean Ethernet
address there).

-Peter



More information about the Python-list mailing list