Re: socket script from perl -> python

2008-02-08 Thread Sion Arrowsmith
Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >kettle <[EMAIL PROTECTED]> writes: >> # pack $length as a 32-bit network-independent long >> my $len = pack('N', $length); >[...] >> the sticking point seems to be the $len variable. >Use len = struct.pack('!L', length) in Python. See >http://docs.python.

Re: socket script from perl -> python

2008-02-07 Thread kettle
On Feb 8, 4:01 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > kettle <[EMAIL PROTECTED]> writes: > > # pack $length as a 32-bit network-independent long > > my $len = pack('N', $length); > [...] > > the sticking point seems to be the $len variable. > > Use len = struct.pack('!L', length) in Python.

Re: socket script from perl -> python

2008-02-07 Thread Hrvoje Niksic
kettle <[EMAIL PROTECTED]> writes: > # pack $length as a 32-bit network-independent long > my $len = pack('N', $length); [...] > the sticking point seems to be the $len variable. Use len = struct.pack('!L', length) in Python. See http://docs.python.org/lib/module-struct.html for details. -- htt

Re: socket script from perl -> python

2008-02-07 Thread kettle
On Feb 8, 12:08 am, Bjoern Schliessmann wrote: > kettle wrote: > > Hi I have a socket script, written in perl, which I use to send > > audio data from one server to another. I would like to rewrite > > this in python so as to replicate exactly the functionality of the > > perl script, so as to in

Re: socket script from perl -> python

2008-02-07 Thread Jerry Hill
On Feb 7, 2008 9:39 AM, kettle <[EMAIL PROTECTED]> wrote: > f = open('/home/myuname/socket.wav','rb') > audio = "" > for line in f: > audio += line I don't know anything about socket programming in python, but this bit doesn't seem right for working on a binary file. You should just read all

Re: socket script from perl -> python

2008-02-07 Thread Bjoern Schliessmann
kettle wrote: > Hi I have a socket script, written in perl, which I use to send > audio data from one server to another. I would like to rewrite > this in python so as to replicate exactly the functionality of the > perl script, so as to incorporate this into a larger python > program. Unfortunat