-
December 3rd, 2003, 10:18 PM
#1
Junior Member
question
What is "Network Byte Order" and "Host Byte Order" and what's the difference between them?
-
December 3rd, 2003, 10:33 PM
#2
Network Byte order: The order in which the bytes of a multi-byte number are transmitted on a network - most significant byte first
Host Byte Order: The order in which the host processes and stores data
I think this is correct, please correct em if I am wrong. Oh and on some systems the two are the same so there is no need for conversion.
-
December 3rd, 2003, 10:36 PM
#3
Indeed XTC46, is right
2good4u, here's an answer to your question from FOLDOC
http://wombat.doc.ic.ac.uk/foldoc/fo...ork+byte+order
It's like "Big-Endian" a lot of cpu's are like that, for example the IBM370
-
December 3rd, 2003, 10:38 PM
#4
Here' what I found.
Network and Host Byte Order Functions
Byte order is dependent on the CPU Word architecture. In processors compatible with Intel processors, 4 byte long integers are represented as a sequence of 4 bytes, with the less significant bytes of the integer stored in the more significant bytes. This byte order is called host byte order or little endian order (little-end-first).
In contrast, most mainframe CPUs, Motorola CPUs, and RISC-designed CPUs store 4 byte long integers with the most significant bytes of an integer before the less significant bytes. This byte order is called network byte order or big endian order (big-end-first).
By default, heterogeneous TCP/IP networks transmit integers, IP addresses, and port number in network byte order. Because NetWare® runs on host byte order machines, you will need to switch between host byte order and network byte order.
The following functions allow you to switch integers between these two formats.
Function Description
htonl Converts 32-bit quantities from host to network byte order.
htons Converts 16-bit quantities from host to network byte order.
ntohl Converts 32-bit quantities from network to host byte order.
ntohs Converts 16-bit quantities from network to host byte order.
Sorry, I need to give due credit. http://developer.novell.com/ndk/doc/...a/ai88kkq.html
-
December 4th, 2003, 10:39 PM
#5
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|