开发者

Is it possible to measure packet rate with libpcap?

I have a开发者_开发问答 python script, that uses libpcap (pcapy) to capture some specific packets, for example, packets from 10.1.1.1 to 10.2.2.2. Is it possible to measure that data transfer rate? I mean, we can get a size of packet, but as I understand, we can't find out how long did it take to transfer that packet. Is there some another way to measure packet rate?


You could use time to time how long it takes to get the packet:

import time
start = time.time()
# do something you want to time
elapsed = time.time() - start
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜