write unsigned integer 32 bits to socket

Alan Franzoni alan.franzoni.blahblah at example.com.invalid
Mon Jul 28 04:02:42 EDT 2008


Michael Torrie was kind enough to say:

> Of course any time you send coherent numbers over the network, I highly
> recommend you use what's called network byte order.  In C, you'd use the
>  htonl() call, and then when pulling it off the wire on the other end
> you'd use ntohl().  If you don't then you will have problems when the
> endianness is different between the hosts.  Standard convention (even in
> the MS word) is to use big-ending across the network.  I'm sure python
> has some convention in the struct module for dealing with this.

Not in the struct module; such functions are available in the socket
module, and should be employed indeed.


-- 
Alan Franzoni <alan.franzoni.xyz at gmail.com>
-
Remove .xyz from my email in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E



More information about the Python-list mailing list