Find the answer to your Linux question:
Results 1 to 4 of 4
Hi friends, Till date there is no standardization of the byte ordering formats i.e little-endian ( used in linux ) or big-endian in the TCP/IP code. Solaris is using big-endian ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2003
    Location
    chennai,tamilnadu,india
    Posts
    16

    Byte ordering ......


    Hi friends,
    Till date there is no standardization of the byte ordering formats i.e little-endian ( used in linux ) or big-endian in the TCP/IP code.
    Solaris is using big-endian format but Linux is using little-endian format. These issues can be handled in the presentation layer which is embedded in the application layer. So why there is no standardization ???

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    If I'm understanding you correctly, you are referring to the data structures in the TCP header, isn't that right? In that case, you are wrong. The TCP header uses purely big-endian numbers. That's why you use the htons() and related functions.

  3. #3
    Just Joined!
    Join Date
    May 2003
    Location
    chennai,tamilnadu,india
    Posts
    16

    i understand dolda ...

    dolda i could understand what u say . what iam asking is

    OS host byte order

    GNU/Linux little-endian
    Solaris big-endian

    but in the tcp header we are using the big-endian order and therefore we convert the little-endian order by using the htons(), pton() etc.
    my question is y is there no standard in the host side.

    bcoz of this suppose we r writing a server program that does the binary addition ( solaris os ) and the client program ( Linux os ) that just sends the input and gets back the output from the server program , the problem arises. when we i/p -ve no.s wrong o/p is given.

    for more details refer Network programming by richard stevens , volume 1 , chapter 5.

    help me !!!

    bye

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I'm not sure that I understand exactly what you're saying.
    Why there is no standard on the host side is rather obvious; different CPU manufacturers simply tend to like one approach over the other. Some prefer big-endian, since all bits are linear, while some prefer little-endian, since many problems are solved by being able to address the least significant byte at the first offset. Personally, I prefer little-endian, but that's just me.

    Anyhow, what exactly is it that you're trying to do, and how is it messed up by this? If you want to send binary numbers between platforms with different endianess, just encode them with htons or ltons on transmission, and ntohs or ntols on the receiving side. That will ensure that you always get the endianess of your CPU.

Posting Permissions

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