如何检查所有已保存到捕获文件的帧? [英] How I can check all the frames has been save to capture file?

查看:90
本文介绍了如何检查所有已保存到捕获文件的帧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

  我已经使用NetMonitor API进行实时数据包捕获.我对NW API有一些疑问.

   I have used the NetMonitor API to do the real time packet capture. I have some questions for the NW API.

首先,NW是否有任何API可以检查适配器缓冲区中的所有数据包数据是否已被处理?

First, Does NW has any API can check that all the packets data in the adapter buffer has been processed?

我发现,如果我调用NmStopCapture,即使适配器缓冲区中可能有数据包,NW也会立即停止回调函数,让我调用NmAddFrame函数.在调用NmStopCapture之前,我必须调用sleep函数进行一些延迟, 否则,我将丢失捕获文件中的某些数据包.我不知道我需要多长时间才能致电给我NmStopCapture函数.有什么方法可以检查状态,或者如何确保所有帧都已保存以捕获 文件?其次,每帧的时间偏移是多少?我做了一些测试,发现帧的时间偏移是帧保存时间而不是帧捕获时间.这是当前的吗?

I found out that if I call NmStopCapture, the NW will immediately stop the callback function for me to call NmAddFrame function even if there may have packets in adapter buffer. I have to call sleep function to make some delay before I call NmStopCapture, otherwise, I will loss some of the packets in the capture file. I don't know how long the delay I need for before I call the  NmStopCapture function. Does there is any way to check the status or how I can make sure all the frame has been saved to capture file? Second, What is time offset in the each frame? I did some test and found out the frame's time offset is the frame save time not the frame capture time. Is this currect ?

感谢您的帮助.

HoFa

 

 

推荐答案

调用NmConfigAdapter时,可以选择NmCaptureCallbackExitMode.默认情况下,它设置为NmDiscardRemainFrames,这意味着它将丢弃缓冲区中的剩余帧,这就是默认情况下丢失帧的原因.

When you call NmConfigAdapter, there are to choices for the NmCaptureCallbackExitMode.  By default it's set to NmDiscardRemainFrames, which means it will discard and remaining frames in the buffer which is why you lose frames by default.

相反,在调用NmConfigAdapter时,将此值设置为NmReturnRemainFrames,引擎将继续向回调发送帧,直到清空缓冲区为止.

Instead, set this value to NmReturnRemainFrames when you call NmConfigAdapter and the engine will continue to send frames to the callback until the buffer is emptied.

希望这可以解决您的问题.

Hopefully this will resolve your issue.

Paul


这篇关于如何检查所有已保存到捕获文件的帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆