我需要帮助来解决这个问题,我正在运行一个python脚本,用于检查两台PC之间的UDP数据传输使用IPERF.Problem,在第一次telnet和配置后,它关闭服务器会话并打开创建的客户端会话来自iperf服务器的错误。
def tc01server(ipaddr,login,password):
try:
ss = pexpect.spawn(ipaddr)
print ss
ss.expect (":")
#ss.logfile = open("/tmp/telnetlog", "a")
ss.logfile = sys.stdout
print "connected to telnet"
print
except:
print "telconnnet connection refused"
print
sys.exit()
try:
ss.send(login + "\r")
ss.expect(":")
ss.send(password + "\r")
ss.send("\r\n")
except:
print "telconnnet connection refused"
print
sys.exit()
def tc01client(ipaddr,login,password):
try:
css = pexpect.spawn(ipaddr)
print css
css.expect (":")
css.logfile = open("/tmp/mynewlog", "w")
#css.logfile = sys.stdout
print "connected to telnet"
print
except:
print "telnet connection refused"
print
sys.exit()
try:
css.send(login + "\r")
css.expect(":")
print "connected"
css.send(password + "\r")
css.send("\r\n")
except:
print "telconnnet connection refused"
print
sys.exit()
任何人都可以告诉我如何在不关闭对方的情况下一次运行多个会话。提前谢谢。如果不清楚,请告诉我。