[Tutor] Basic telnet question
David Rock
david at graniteweb.com
Sat Sep 24 11:01:18 EDT 2016
> On Sep 24, 2016, at 04:21, Phil <phil_lor at bigpond.com> wrote:
>
> The problem is that the client is not responding, certainly not as expected. There aren't any Python errors either, however, the console is blocked until the client is disabled. If I then attempt a connection with the disabled client a Python connection refused error is displayed, as I would expect.
>
> I have read the telnetlib document and searched for examples but I seem to be stuck on a very basic problem.
>
> By the way, I'm using Python 3.5 under Linux.
when you say "the client is not responding, certainly not as expected”, what, exactly, is the output you get?
read_all is a bit touchy, and it’s a blocking operation. the blocking part is likely why the console is blocked. read_all doesn’t know it should give things back to you just because you don’t see any new data; it’s still trying to read everything until it times out.
either add a short timeout value to your telnetlib.Telnet(), or try a different read method; for example, read_very_eager
you could also try using telnetlib.set_debuglevel() to try and get more details about what’s actually happening.
—
David Rock
david at graniteweb.com
More information about the Tutor
mailing list