write unsigned integer 32 bits to socket

Alan Franzoni alan.franzoni.blahblah at example.com.invalid
Mon Jul 28 12:01:41 EDT 2008


Scott David Daniels was kind enough to say:

> Alan Franzoni wrote:

> Please don't pass this misinformation along.
> 
> In the struct module document, see the section on the initial character:
>      Character Byte order Size and alignment
>        @          native            native
>        =          native           standard
>        <       little-endian       standard
>        >        big-endian         standard
>        !    network (= big-endian) standard

Sure, that's is one way to do it... but I was answering Micheal Torrie, who
said:

> 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

htonl() and ntohl() are available in Python in the socket module, so:
1) i was just pointing the OP to the right place where to find such
functions
2) they work just the same way, hence I can't see why the "struct" way
should be the preferred one while the "socket" way should be misinformation
:P

Bye!

-- 
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