Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61924
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <drsalists@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; '"""': 0.07; 'socket': 0.07; 'advance': 0.07; 'string': 0.09; 'back.': 0.09; 'dan': 0.09; 'implements': 0.09; 'subject:trying': 0.09; 'whatever.': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'adapter': 0.16; 'cc:name:python list': 0.16; 'measurement': 0.16; 'paste.': 0.16; 'port)': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'subject:] ': 0.20; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'install': 0.23; 'module,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'host': 0.29; 'am,': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; "skip:' 10": 0.31; 'jean': 0.31; 'anyone': 0.31; 'allows': 0.31; 'linux': 0.33; 'url:python': 0.33; '-----': 0.33; 'skip:# 10': 0.33; 'could': 0.34; 'december': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; "i'll": 0.36; 'url:org': 0.36; 'e.g.': 0.38; 'url:library': 0.38; 'system.': 0.39; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'tell': 0.60; 'equipment': 0.61; 'skip:t 30': 0.61; 'browser': 0.61; 'simple': 0.61; "you're": 0.61; 'first': 0.61; 'kind': 0.63; 'such': 0.63; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'sample': 0.67; 'cut': 0.74; 'instrument': 0.93; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=W8Xl+KiqRJCcxLuCtN4nSS1kenOtXOM7+fHID6nUJLQ=; b=DDAW7WynZNX2MYZXXvuCf+/zPGzAVVCxypCZTKf5AZ888+PwX7wVNi9lLd0AYlvh3Y /WVbOpCz8+E7N7CCcFevy+WB9+ud3W4yf2vuGZLRsoD51qoUmaLZRvFRd154ROCHycwm LW4PSDxfq76Kl92UHZPnFhumO/QK/t7l+DznDFhk1exAg+ZJdOJq9PrMlb3rOsFHktsj SDtibDn3kwZdXrTUgpI9XmuO2ZpWXWfSULTug+nyPBfYLn/yQtkkaXEdb/G7ID/kfv/9 lnUpTfoDaiXb1XiTulh5227Dpmsk6ZBFEskrsNKdPGCyePAj5uM/s7Cm8M/AnN2vNsTA eoeQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.194.2.79 with SMTP id 15mr358935wjs.90.1387069394825; Sat, 14 Dec 2013 17:03:14 -0800 (PST) |
| In-Reply-To | <180e238a-2110-41d9-a13f-df3355bd26c4@googlegroups.com> |
| References | <efae1b3c-c9c5-4ef4-8e94-7fbe8716ab53@googlegroups.com> <mailman.4072.1386948939.18130.python-list@python.org> <180e238a-2110-41d9-a13f-df3355bd26c4@googlegroups.com> |
| Date | Sat, 14 Dec 2013 17:03:14 -0800 |
| Subject | Re: [newbie] trying socket as a replacement for nc |
| From | Dan Stromberg <drsalists@gmail.com> |
| To | Jean Dubois <jeandubois314@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | Python List <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.4130.1387069401.18130.python-list@python.org> (permalink) |
| Lines | 52 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1387069401 news.xs4all.nl 2883 [2001:888:2000:d::a6]:52278 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:61924 |
Show key headers only | View raw
On Sat, Dec 14, 2013 at 5:33 AM, Jean Dubois <jeandubois314@gmail.com> wrote:
> Op vrijdag 13 december 2013 16:35:31 UTC+1 schreef Jean-Michel Pichavant:
>> ----- Original Message -----
>> > I have an ethernet-rs232 adapter which allows me to connect to a
>> > measurement instrument by means of netcat on a linux system.
>> > e.g. entering nc 10.128.59.63 7000
>> > allows me to enter e.g.
>> > *IDN?
>> > after which I get an identification string of the measurement
>> > instrument back.
>> > I thought I could accomplish the same using the python module
>> > "socket"
>> > and tried out the sample program below which doesn't work however:
>> > #!/usr/bin/env python
>> >
>> > """
>> > A simple echo client
>> > """
>> > import socket
>> > host = '10.128.59.63'
>> > port = 7000
>> > size = 10
>> > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>> > s.connect((host,port))
>> > s.send('*IDN?')
>> > data = s.recv(size)
>> > s.close()
>> > print 'Received:', data
>> >
>> > Can anyone here tell me how to do it properly?
>> > thanks in advance
>> > jean
>> Such equipment often implements a telnet protocol. Have use try using the telnetlib module ?
>> http://docs.python.org/2/library/telnetlib.html
>> t = Telnet(host, port)
>> t.write('*IDN?')
>> print t.read_until('Whateverprompt')
>> # you can use read_very_eager also
>> JM
> Thanks for the suggestion, I'll first wait for a response from Dan Stromberg concerning how to install his module, if he doesn't answer or if I'm still unsuccessfull then I'll try out your suggestion
>
> kind regards,
> jean
> --
> https://mail.python.org/mailman/listinfo/python-list
You can "svn checkout <url>". You might try Sliksvn if you're on
Windows, or if you're on Linux it's in synaptic or yum or whatever.
You can "wget <url>".
You can bring up the URL in a web browser and cut and paste.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [newbie] trying socket as a replacement for nc Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-12-13 16:35 +0100
Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-14 05:33 -0800
Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-14 17:03 -0800
Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-15 07:35 -0800
Re: [newbie] trying socket as a replacement for nc Chris Angelico <rosuav@gmail.com> - 2013-12-16 02:50 +1100
Re: [newbie] trying socket as a replacement for nc Dan Stromberg <drsalists@gmail.com> - 2013-12-15 13:14 -0800
csiph-web