Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62171 > unrolled thread

Re: [newbie] trying socket as a replacement for nc

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2013-12-17 10:37 +0100
Last post2013-12-18 19:36 -0800
Articles 4 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: [newbie] trying socket as a replacement for nc Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-12-17 10:37 +0100
    Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-18 05:04 -0800
      Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-18 06:48 -0800
        Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-18 19:36 -0800

#62171 — Re: [newbie] trying socket as a replacement for nc

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2013-12-17 10:37 +0100
SubjectRe: [newbie] trying socket as a replacement for nc
Message-ID<mailman.4271.1387273058.18130.python-list@python.org>
> 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.
If you fixed the syntax error, you should be pretty close to the solution though.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[toc] | [next] | [standalone]


#62301

FromJean Dubois <jeandubois314@gmail.com>
Date2013-12-18 05:04 -0800
Message-ID<d246740c-e351-471f-a560-dd44d145b1d1@googlegroups.com>
In reply to#62171
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

kind regards,
jean

[toc] | [prev] | [next] | [standalone]


#62304

FromJean Dubois <jeandubois314@gmail.com>
Date2013-12-18 06:48 -0800
Message-ID<af6ef461-836f-4794-b2c2-454fe2d7b6a3@googlegroups.com>
In reply to#62301
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
t.write('\n')
prompt = t.read_very_eager()
t.write('*IDN?\n')
print t.read_until('\n',5)

thanks to all here for the help offered

kind regards,
jean

[toc] | [prev] | [next] | [standalone]


#62360

FromJean Dubois <jeandubois314@gmail.com>
Date2013-12-18 19:36 -0800
Message-ID<3f5b6bfc-4d6b-4d51-9ec2-24941156d5c8@googlegroups.com>
In reply to#62304
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
> t.write('\n')
> prompt = t.read_very_eager()
> t.write('*IDN?\n')
> print t.read_until('\n',5)
>
I erased the two superfluous lines in the code above, so the code now is this:
#!/usr/bin/env python
import telnetlib
host = '10.128.56.202'
port = 6000
t = telnetlib.Telnet(host, port)
t.read_very_eager() #flush
t.write('*IDN?\n')
readstring=t.read_until('\n',5)

jean

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web