Results 1 to 5 of 5

Thread: question

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    29

    Question question

    What is "Network Byte Order" and "Host Byte Order" and what's the difference between them?

  2. #2
    Senior Member
    Join Date
    May 2003
    Posts
    1,199
    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.
    Everyone is going to die, I am just as good of a reason as any.

    http://think-smarter.blogspot.com

  3. #3
    Senior since the 3 dot era
    Join Date
    Nov 2001
    Posts
    1,542
    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

  4. #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

  5. #5
    Junior Member
    Join Date
    Apr 2002
    Posts
    29
    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •