14. telnetlib (1/3)
What's wrong with read_until/expect?
What telnetlib does:
Server → telnetlib connection→ telnetlib.read_until
What I need:
Server → telnetlib connection → bsdconv → telnetlib.read_until
Regular Expression
Solutions:
a) Implement bsdconv → telnetlib.read_until (current)
b) Hack telnetlib (maybe cleaner)
c) Other telnetlib implementation?
15. telnetlib (2/3)
#Deal with lagging/noop
def term_comm(feed=None, wait=None):
if feed!=None:
conn.write(feed)
if wait:
s=conn.read_some()
s=conv.conv_chunk(s)
stream.feed(s.decode("utf-8"))
if wait!=False:
time.sleep(0.1)
s=conn.read_very_eager()
s=conv.conv_chunk(s)
stream.feed(s.decode("utf-8"))
ret="n".join(screen.display).encode("utf-8")
return ret
Reading Feed No Feed
Wait=None Non-blocking Non-blocking
Wait=True Blocking Non-blocking (unused)
Wait=False No No
16. telnetlib (3/3)
#Deal with lagging/noop
Action with or without screen refresh
term_comm('Action A', False)
term_comm('Action B', True)
#Action A+B cause screen refresh
Action with screen refresh (important content)
term_comm('Action', True)
Action with screen refresh
term_comm('Action')
Wait+Retry
Reading Feed No Feed
Wait=None Non-blocking Non-blocking
Wait=True Blocking Non-blocking (unused)
Wait=False No No