python - 防止 tcpreplay 阻塞 Mininet Python API cmds
问题描述
我需要执行多个不同的命令来将 pcaps 重播到我的网络中。
第一个 pcap 超过 100 秒,我需要播放它,然后立即播放其他 pcap。
我的问题是,当我在我的 python 代码中执行这一行时:
h2.cmd('tcpreplay --intf1=h2-eth0 BenignTest.pcap 10.0.0.1')
程序在继续之前等待这 100 秒的 pcap 完成。我需要程序在发送该命令后立即继续。
有没有办法让 tcpreplay 像这样非阻塞?
解决方案
原来它就像添加&
到命令的末尾一样简单。
h2.cmd('tcpreplay --intf1=h2-eth0 BenignTest.pcap 10.0.0.1 &')
&
将命令发送到后台并释放正在使用的终端。
https://bashitout.com/2013/05/18/Ampersands-on-the-command-line.html
推荐阅读
- javascript - 尝试发送组合键击 (Shift RightArrow) 或触发事件 JQ 2.0.3
- r - 从同一数据集的不同变量创建平滑图
- javascript - 节点 mysql.js。如何正确关闭连接
- r - dplyr mutate_if 有多个条件?
- python - 在不同时间满足条件时停止 python for 循环
- python - 'list' 对象没有属性 'title' 尝试打印文本时
- mysql - 全文分数计算时间长
- mongodb - 启动 ApplicationContext 时出错。要显示条件报告,请使用“调试”重新运行您的应用程序
- ios - react-native-firebase notifications().onNotification() 永远不会在 ios 中调用
- php - 如何在 PHP Laravel 中删除除字符“ñ / Ñ”和破折号“-”之外的特殊字符