In the past, when using Winpcap to capture packets from the NIC, only one Nic was captured. Now you have to capture multiple NICs as needed, because our previous device is a computer that connects to a device through a network card, there are now two user requirements, one is to attach two network cards on the computer, each network card is connected to a device, another requirement is to connect multiple devices through a network adapter on the PC through a switch. There is a many-to-many relationship in the future, that is, a device sends data to different PCs through a switch, all of these considerations! Welcome to discuss ideas!
1) when a computer has two NICs and each Nic is connected to a device, my method is as follows:
Enable two NICs, enable one thread for each Nic to capture data separately, and perform parallel operations on the two NICs.
2) connect multiple devices through one Nic of a PC on the switch. This is the same as that of a single device. Winpcap captures packets sent from different devices and then parses the packets at the application layer, in this way, the user can know which data is sent by the device.
3) when multiple PCs are connected to multiple devices, consider 1) and 2)