Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38692
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ihsan@grep.my> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'mrab': 0.05; 'chunk': 0.07; 'advice.': 0.09; "b''": 0.09; '"1.0",': 0.16; '"2":': 0.16; 'chunk:': 0.16; 'closed:': 0.16; 'received:124.108': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'feb': 0.19; 'thanks.': 0.21; 'connected': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'url:mailman': 0.29; 'connection': 0.30; 'code': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; '11,': 0.33; 'to:addr:python-list': 0.33; 'received:172.16': 0.34; 'thanks': 0.34; 'url:org': 0.36; 'should': 0.36; 'charset:us- ascii': 0.36; 'sent:': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'url:mail': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.62; 'received:': 0.62; '20,': 0.65; 'received:my': 0.93 |
| Content-Type | text/plain; charset=us-ascii |
| Mime-Version | 1.0 (Mac OS X Mail 6.2 \(1499\)) |
| Subject | Re: Python recv loop |
| From | Ihsan Junaidi Ibrahim <ihsan@grep.my> |
| In-Reply-To | <51184F74.60902@mrabarnett.plus.com> |
| Date | Mon, 11 Feb 2013 23:08:05 +0800 |
| Content-Transfer-Encoding | quoted-printable |
| References | <B52841CC-778D-41AF-AFCC-05A5F9C26A92@grep.my> <51184F74.60902@mrabarnett.plus.com> |
| To | python-list@python.org |
| X-Mailer | Apple Mail (2.1499) |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1657.1360595288.2939.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1360595288 news.xs4all.nl 6876 [2001:888:2000:d::a6]:39784 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:38692 |
Show key headers only | View raw
Hi MRAB,
My code now works thanks to your advice.
{"msgver": "1.0", "msgid": "200", "subcode": "100", "appver": "1.0", "appid": "1.0", "data": {"1": "igb0", "2": "igb1", "ifcnt": "2"}}
connected to misty:8080
sending data
138 bytes sent: 0x86{"msgver": "1.0", "msgid": "200", "subcode": "100", "appver": "1.0", "appid": "1.0", "data": {"1": "igb0", "2": "igb1", "ifcnt": "2"}}
receiving data
message length is 188
188 bytes received: { "msgver": 1.000000, "appver": 1.000000, "appid": 1000, "msgid": 10, "subcode": 20, "data": [ "110.159.183.16", "124.108.16.94", "2400:3700:50::2", "2400:3700:50::1", "2400:3700:51::" ] }
Many thanks.
On Feb 11, 2013, at 9:55 AM, MRAB <python@mrabarnett.plus.com> wrote:
> You should keep reading until you get all need or the connection is
> closed:
>
> buf = b''
> while len(buf) < nbuf:
> chunk = sock.recv(nbuf - len(buf))
>
> if not chunk:
> break
>
> buf += chunk
>
> --
> http://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python recv loop Ihsan Junaidi Ibrahim <ihsan@grep.my> - 2013-02-11 23:08 +0800
csiph-web