开发者

Is it possible to measure packet rate with libpcap?

开发者 https://www.devze.com 2023-03-17 03:39 出处:网络
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

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

精彩评论

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