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. Unfortunately I still don't really have the hang of > socket programming in python.
Socket programming in Python is just like socket programming in C. I suppose with Perl it's the same. > # pack $length as a 32-bit network-independent long > my $len = pack('N', $length); > [...] > I've used python's socket library to connect to the server, and > verified that the first piece of data'r' is read correctly, the > sticking point seems to be the $len variable. I've tried using > socket.htonl() and the other less likely variants, but nothing > seem to produce the desired result, which would be to have the > server-side message print the same 'length' as the length printed > by the client. Try struct.calcsize. Regards, Björn -- BOFH excuse #88: Boss' kid fucked up the machine -- http://mail.python.org/mailman/listinfo/python-list