[quoted text, click to view] On Sun, 30 Dec 2007 02:12:08 -0800, Neil <wassoft@newsgroup.nospam> wrote:
> I have a ethernet NIC and a wireless NIC.
> I need to bind to the ethernet NIC specifically, which might have IP
> 192.168.0.3, the ethernet NIC might have an IP of 192.168.0.5.
Differentiating between a wireless and wired NIC is not the same as
differentiating between an "active" and an "inactive" NIC.
[quoted text, click to view] > By active network interface, I mean the interface currently receiving
> packets. So, I need to know which of the two interfaces is being used to
> receive packets so that I can bind the socket to the correct IP.
Again, what do you mean by "active"? "Currently receiving" doesn't really
do it. Either NIC, as long as its enabled, could be "currently receiving".
Also, what behavior do you expect to achieve by binding to a specific IP
address? Binding will affect what addresses are valid for sending data to
a socket, but it won't affect which NIC is used to send from that socket.
So far, your definition of "active" seems to be tied to which NIC is
actually receiving data, so I don't see the point in trying to bind to a
specific network card in this case, since by your definition your socket
is already only receiving data on the "active" NIC, and that's the most
you could hope for by binding a socket to a specific address.
[quoted text, click to view] > All of this is being used in a packet sniffing app we are developing.
You might want to look at Wireshark (was named "Ethereal"). It's an
already-existing network analysis tool. It might make more sense to just
use that rather than do this yourself.