[newbie] trying socket as a replacement for nc

Jean-Michel Pichavant jeanmichel at sequans.com
Mon Dec 16 17:44:31 CET 2013

> This is what I got using telnet:
> [jean:~] $ telnet 7000
> Trying
> Connected to
> 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 = ''
port = 7000
t = Telnet(host, port)

def flush()

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

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



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.

More information about the Python-list mailing list