[Tutor] Basic telnet question

Phil phil_lor at bigpond.com
Sat Sep 24 16:49:51 EDT 2016


On 25/09/16 01:01, David Rock wrote:
>
>> 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?
>

In my dazed state I think I responded to David personally instead of the 
list, my apologies.

Thank you for your reply David.

This is what I expect:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

But, as I say, the console is blocked and nothing is returned.

I'll try the debug method that you suggested.


> 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.
>

-- 
Regards,
Phil


More information about the Tutor mailing list