防止tcpreplay阻止Mininet Python API cmds

问题描述 投票:0回答:1

我需要执行多个不同的命令来将pcaps重放到我的网络中。

第一个pcap超过100秒,我需要播放它然后立即播放其他pcaps。

我的问题是,当我在我的python代码中执行此行时:

h2.cmd('tcpreplay --intf1=h2-eth0 BenignTest.pcap 10.0.0.1')

该程序在继续之前等待这100秒的pcap完成。我需要程序在发送该命令后立即继续。

有没有办法像这样使tcpreplay非阻塞?

python mininet tcpreplay
1个回答
0
投票

事实证明,就像在命令末尾添加&一样简单。

h2.cmd('tcpreplay --intf1=h2-eth0 BenignTest.pcap 10.0.0.1 &')

&将命令发送到后台并释放正在使用的终端。

https://bashitout.com/2013/05/18/Ampersands-on-the-command-line.html

© www.soinside.com 2019 - 2024. All rights reserved.