[newbie] trying socket as a replacement for nc
jeandubois314 at gmail.com
Thu Dec 19 04:36:18 CET 2013
Op woensdag 18 december 2013 15:48:43 UTC+1 schreef Jean Dubois:
> Op woensdag 18 december 2013 14:04:08 UTC+1 schreef Jean Dubois:
> > Op dinsdag 17 december 2013 10:37:37 UTC+1 schreef Jean-Michel Pichavant:
> > > > I'm a newbie in Python programming that is very much true, and
> > > > contrary to what you seem to suggest I did my homework
> > > At no point that was my intention, my apologies.
> > OK, no problem
> > > If you fixed the syntax error, you should be pretty close to the solution though.
> > thanks, I'll look further into it when I find a bit more time
> I finally got it working:
> #!/usr/bin/env python
> import telnetlib
> host = '10.128.56.202'
> port = 6000
> t = telnetlib.Telnet(host, port)
> t.read_very_eager() #flush
> prompt = t.read_very_eager()
> print t.read_until('\n',5)
I erased the two superfluous lines in the code above, so the code now is this:
host = '10.128.56.202'
port = 6000
t = telnetlib.Telnet(host, port)
More information about the Python-list