Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'mrab': 0.05; 'binary': 0.07; 'method.': 0.07; 'ascii': 0.09; 'expected.': 0.09; 'indeed,': 0.09; 'shifting': 0.09; 'entries.': 0.16; 'whitespace.': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'thu,': 0.19; 'appears': 0.22; 'byte': 0.24; 'text,': 0.24; 'header:In- Reply-To:1': 0.27; 'thus': 0.29; 'wonder': 0.29; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; 'struct': 0.31; 'anyone': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'subject:data': 0.36; 'doing': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; 'first': 0.61; 'email addr:gmail.com': 0.63; 'receiver': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=vZ9cCyM1zAT1bjL6egF/LdIG/uQ1HB6fOd52jGOejWI=; b=zK7WkaIIIfxfoQQSChFdP6QwxB33LnAAV6c+W9GSGq023kOo2ljSQdfjTDSdDmdbaZ xRaRpTjPwcBZvw3AyWFSHiTSHqFyoaZuDrQrQohjE2qtu1DelPro55tfoizwpG2DW8Yo sq/SYCczoXrOF5Q5nx9Rgch3DBU2QAKvfmALe1BZU4PatpOnT6rff+Fq3bEDhy79IFcu e1AKVGu8oRhiafHsIZbtXsGmSBwn2MR9yXzRs9oGQlCFk5vjQbHAjnL19NwEU+UdKtxq rH/P5ZnFrKYldXFTDNDLrHpFMnt9ZyKu0RT794DjmAbyuzBExtef07n2n0s43jQWlpQy GSew== X-Received: by 10.236.13.46 with SMTP id a34mr15177771yha.28.1401405687873; Thu, 29 May 2014 16:21:27 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5387BE21.4010404@mrabarnett.plus.com> References: <5387BE21.4010404@mrabarnett.plus.com> From: Ian Kelly Date: Thu, 29 May 2014 17:20:47 -0600 Subject: Re: Binary data exchange To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401405690 news.xs4all.nl 2911 [2001:888:2000:d::a6]:55546 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72260 On Thu, May 29, 2014 at 5:09 PM, MRAB wrote: > On 2014-05-29 23:08, RasikaSrinivasan@gmail.com wrote: >> the received data for the messages 9 thru 13 are not as expected. >> >> I wonder if anyone can see what I am doing wrong? >> >> Appreciate any hints. thanks, srini >> > I don't understand why you're using the .strip method. That's for > stripping whitespace from text, but you're not sending and receiving > text, you're sending and receiving binary data. And indeed, ASCII characters 9-13 are all whitespace. The receiver appears to be stripping off the first byte of the (presumably little-endian) data and thus shifting the whole struct by a byte for those entries.