-
- MPSendPackets(){
- ....
- pAdapt->nTotalPacketsSeen[pVElan->NetworkConnection]++;
- // If the VElan sending the packet does not correspond to the currently
- // active connection, then buffer packets, else send them
- if (pVElan->NetworkConnection == pAdapt->CurrentActiveConnection &&
- pAdapt->isSSIDActive[pAdapt->CurrentActiveConnection])
- {
- DBGPRINT(MUX_LOUD, ("Sending Packet since SSID is active\n"));
- //
- // Make note of the upcoming send.
- //
- MUX_INCR_PENDING_SENDS(pVElan);
- //
- // Send it to the lower binding.
- //
- NdisSend(&Status,
- pAdapt->BindingHandle,
- MyPacket);
- if (Status != NDIS_STATUS_PENDING)
- {
- PtSendComplete((NDIS_HANDLE)pAdapt,
- MyPacket,
- Status);
- }
- }
- else
- {
-
- if(pAdapt->isSSIDToBeRemoved[pVElan->NetworkConnection] == SET_SSID_TO_BE_REMOVED){
- DBGPRINT(MUX_LOUD,("@@ Throw the packets since isToBeRemoved values is %s @@\n", pAdapt->isSSIDToBeRemoved[pVElan->NetworkConnection]));
- }else{
- // Buffer the packet since adapter is in a different network
- DBGPRINT(MUX_LOUD, ("@@Queueing Packet since SSID is NOT active\n"));
- InsertTailQueue(&pAdapt->SendWaitQueue[pVElan->NetworkConnection], MP_GET_PACKET_MR(MyPacket));
- pAdapt->nWaitSend[pVElan->NetworkConnection]++;
- }
- }
- ........}
这里nTotalPacketsSeen统计了要发送数据包的个数。
上面的程序就是判断当前连接是否激活的,如果是发送数据包,不是的话,缓存数据包。
NdisSend一次只能一个数据包,对吧?
现在我想统计从本机器发送数据包到另外一台机器来测试程序运行是否正确。
可是我发现即使你还没有开始发送真正的数据包,程序还是会调用这些代码做一些比如ICMP的信息的交换(我猜的),这也要调用MPSendPackets()来发送数据。
所以这样就很难统计到底发送了多少个真正要发送的数据包了....程序就很难测试了。郁闷当中。求救!
还有什么软件可以测试当前网卡接收或者发送了多少个数据包呢?谢谢!!