From: Eric Bambach <eric@cisu.net>
To: r_zaca <r_zaca@ig.com.br>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Byte Order
Date: Wed, 12 Jan 2005 11:31:16 -0600 [thread overview]
Message-ID: <200501121131.16555.eric@cisu.net> (raw)
In-Reply-To: <20050112_170357_014648.r_zaca@ig.com.br>
On Wednesday 12 January 2005 11:03 am, you wrote:
> Hello all,
>
> How can I say if the machine where I am working uses "Host Byte Order" or
> "Network Byte Order"?
> Is it an obvius question? I mean, all hosts (machines) uses "Host Byte
> Order" and when it needs to send data through the network it uses "Network
> Byte Order".
> Thanks.
Well,
Im not sure if this answers your question, but when doing network programming
you should always use hton and ntoh conversions to make your program portable
whether or not your machine uses the same byte order as the network.
If you;re asking which architectures are Big Endian and little endian and how
to tell..then im afraid I dont know. Google will tell you which architectures
are which.
However, man pages also say "On machines which have a byte order which is the
same as the network order, routines are defined as null macros." so its safe
and desirable to use whether your machine uses the same of different ordering
anyways.
P.S. If you want to check Endianess perhaps you can pass an int through htons
or ntohs (etc.) and see if it changes the values. If it doesn't, then you're
using the same ordering as the network. Perhaps someone can clarify if this
will actually work its just a stab in the dark.
----------------------------------------
--EB
> All is fine except that I can reliably "oops" it simply by trying to read
> from /proc/apm (e.g. cat /proc/apm).
> oops output and ksymoops-2.3.4 output is attached.
> Is there anything else I can contribute?
The latitude and longtitude of the bios writers current position, and
a ballistic missile.
--Alan Cox LKML-December 08,2000
----------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2005-01-12 17:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-12 17:03 Byte Order r_zaca
2005-01-12 17:31 ` Eric Bambach [this message]
2005-01-12 17:34 ` Jan-Benedict Glaw
-- strict thread matches above, loose matches on Subject: below --
2005-01-13 10:05 r_zaca
2005-01-14 21:31 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200501121131.16555.eric@cisu.net \
--to=eric@cisu.net \
--cc=linux-c-programming@vger.kernel.org \
--cc=r_zaca@ig.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).