Re: Little/Big endian discussion (was: Re: can I burn the output of mpg123 -s?)
On Tue, 18 Aug 1998, Stephen J. Carpenter wrote:
: On Wed, Aug 19, 1998 at 10:54:52AM +1000, Hamish Moffatt wrote:
: > On Tue, Aug 18, 1998 at 08:46:20AM -0400, Stephen J. Carpenter wrote:
: > > currently xfstt bombs out if it gets a connection of a differnt
: > > "endianess" than the system it is on...I have been meaning to fix that but
: > > maybe the PowerPC may have an easier fix...
: > > nah...ill just look into fixing it "right"
: >
: > Ouch.. use htons(), htonl(), ntohs(), ntohl() to convert; you don't
: > have to know what endianness the machine is you're using, you rely
: > on libc knowing and implementing those functions appropriately.
:
: well...
: thats the problem...
: htons et al are empty functions on big-endian systems and thge situation
: actually requires they perform the swap because in this case endian-ness
: matters and sending it in "Network order" is NOT apropriate unless
: "Network Order" is the same as host order on the client.
:
: see teh problem?
: if the other side doesn't ntoh the data then it doesn't work ;)
I'm coming into this late, and perhaps under-armed ... but no, I don't
understand. Network order == big-endian ... so on little-endian
machines htons(), htonl() et. do actually perform a conversion. On a
big-endian system, no conversion is necessary because network order ==
host order on these machines.
This way, every host is transferring information in network order, so
everyone's happy.
Am I missing something?
--
Nathan Norman
MidcoNet 410 South Phillips Avenue Sioux Falls, SD
mailto:finn@midco.net http://www.midco.net
finger finn@home.midco.net for PGP Key: (0xA33B86E9)
Reply to: