在一定时间之后结束脚本的执行-Python
晚上好,大家。我正在实施一个处理网络数据包的函数。目前,我使用了一段时间的循环,以使该功能始终运行,但是我想在MS中设置时间,并在那段时间结束时循环结束。你能给我一个小费吗?到目前为止,我的循环片段:
while True:
status = pcap.loop(pd, 0, processing_pkts,
ct.cast(ct.pointer(packet_count), ct.POINTER(ct.c_ubyte)))
if status < 0:
break
感谢您的任何提示!!!
Good evening everyone. Guys I'm implementing a function that processes network packets. At the moment I'm using a while loop so that the function is always running, but I would like to set a time in ms and at the end of that time the loop ends. Can you give me a tip? A snippet of my loop so far:
while True:
status = pcap.loop(pd, 0, processing_pkts,
ct.cast(ct.pointer(packet_count), ct.POINTER(ct.c_ubyte)))
if status < 0:
break
Thanks for any tips!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)