telnet interaction shows a ctrl-C

telnet interaction shows a ctrl-C

Postby skew » Wed Sep 25, 2013 4:26 pm

I'm doing some code to interact with a telnet server. When I send any command and receive the output, like this:
Code: Select all
...
tn.write("echo A\n")
sock = tn.get_socket()
buf = ''
while 1:
    r, w, x = select.select([sock], [], [], 1)
    if r:
        buf += tn.read_eager()
    else:
        break
pdb.set_trace()

I always get a ^C after the first prompt:
Code: Select all
(Pdb) p buf
'echo A\r\nA\r\nroot@localhost:/# ^C\r\nroot@localhost:/#

The command doesn't matter. The code snippet above is just the latest, if I use read_until() with or without the socket check, I still get the ctlr-C every time.

I'm still new to python, does anyone know how I can get rid of it? Running telnet directly doesn't show a control-c, nor does the serial port version of this code, so I'm sure it's not the remote shell.

Thanks.
- skew
Last edited by Yoriz on Wed Sep 25, 2013 6:57 pm, edited 1 time in total.
Reason: First post lock
skew
 
Posts: 2
Joined: Wed Sep 25, 2013 3:46 pm

Re: telnet interaction shows a ctrl-C

Postby skew » Wed Sep 25, 2013 11:57 pm

... I'll add that I get the ^C plus the second prompt.
skew
 
Posts: 2
Joined: Wed Sep 25, 2013 3:46 pm


Return to Networking

Who is online

Users browsing this forum: No registered users and 0 guests