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


Groups > comp.lang.python > #62076

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

Date 2013-12-16 17:44 +0100
From Jean-Michel Pichavant <jeanmichel@sequans.com>
Subject Re: [newbie] trying socket as a replacement for nc
Newsgroups comp.lang.python
Message-ID <mailman.4222.1387212273.18130.python-list@python.org> (permalink)

Show all headers | View raw


> This is what I got using telnet:
> [jean:~] $ telnet 10.128.59.63 7000
> Trying 10.128.59.63...
> Connected to 10.128.59.63.
> Escape character is '^]'.
> *IDN?
> KEITHLEY INSTRUMENTS INC.,MODEL 2425,1078209,C32   Oct  4 2010
> 14:20:11/A02  /E/
>                                                                  H
> 
> after pressing CTRL-ALT-ALTGR-] I get this:
> ^[^]
> after which I get the telnet-prompt
> >telnet
> and I can quit telnet by entering quit
> 
> 
> kind regards,
> jean
> --
> https://mail.python.org/mailman/listinfo/python-list


Looks like you don't have any prompt.
Try something simple first:

import telnetlib
host = '10.128.59.63'
port = 7000
t = Telnet(host, port)

def flush()
  t.read_very_eager()

def sendCmd(cmd)
  t.write('%s\n' % cmd)
  return flush()

flush()
print sendCmd('*IDN?')
print sendCmd('*OPC?')


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.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [newbie] trying socket as a replacement for nc Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-12-16 17:44 +0100
  Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-16 10:26 -0800
    Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-17 05:35 +1100
    Re: [newbie] trying socket as a replacement for nc Dave Angel <davea@davea.name> - 2013-12-16 13:42 -0500

csiph-web