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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=0559fdd6f=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.038
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'subject:: [': 0.04; 'escape': 0.09; 'subject:trying': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'first:': 0.16; 'port)': 0.16; 'pressing': 0.16; 'trying': 0.19; 'subject:] ': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'connected': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'host': 0.29; 'character': 0.29; 'url:mailman': 0.30; "skip:' 10": 0.31; 'jean': 0.31; 'url:python': 0.33; 'something': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'thank': 0.38; 'url:mail': 0.40; 'simple': 0.61; 'you.': 0.62; 'information': 0.63; 'kind': 0.63; 'received:194': 0.64; 'to:addr:gmail.com': 0.65; 'notice:': 0.67; 'person,': 0.68; 'privileged.': 0.69; 'disclose': 0.74; 'medium.': 0.91
X-IronPort-AV E=Sophos;i="4.95,495,1384297200"; d="scan'208";a="2246721"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Mon, 16 Dec 2013 17:44:31 +0100 (CET)
From Jean-Michel Pichavant <jeanmichel@sequans.com>
To Jean Dubois <jeandubois314@gmail.com>
In-Reply-To <41954a05-c9bd-43f7-9427-915653ff8657@googlegroups.com>
Subject Re: [newbie] trying socket as a replacement for nc
MIME-Version 1.0
X-Mailer Zimbra 7.2.4_GA_2900 (ZimbraWebClient - GC31 (Win)/7.2.4_GA_2900)
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding base64
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4222.1387212273.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387212273 news.xs4all.nl 2909 [2001:888:2000:d::a6]:46377
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62076

Show key headers only | 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