Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. little indian or big indian?

little indian or big indian?

Scheduled Pinned Locked Moved IT & Infrastructure
question
10 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Massimiliano Conte
    wrote on last edited by
    #1

    hi all! does anyone knows if there is a "strong" specification on sending numeric data using TCP/IP protocol? Do i HAVE TO send any integer in my structs in any specific byte-order? thanks all! :)

    T L M J 4 Replies Last reply
    0
    • M Massimiliano Conte

      hi all! does anyone knows if there is a "strong" specification on sending numeric data using TCP/IP protocol? Do i HAVE TO send any integer in my structs in any specific byte-order? thanks all! :)

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      use these : htons()[^] htonl()[^] ntohs()[^] ntohl()[^]


      TOXCCT >>> GEII power

      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

      1 Reply Last reply
      0
      • M Massimiliano Conte

        hi all! does anyone knows if there is a "strong" specification on sending numeric data using TCP/IP protocol? Do i HAVE TO send any integer in my structs in any specific byte-order? thanks all! :)

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        JonathanLivingstone wrote:

        Do i HAVE TO send any integer in my structs in any specific byte-order?

        Only if you want it to work correctly!  http://en.wikipedia.org/wiki/Endianness[^]

        "Alot of the people on this forum are incredibly stupid, thinking that the internet is real"
        Score: 1.0 in the Soap Box

        led mike

        1 Reply Last reply
        0
        • M Massimiliano Conte

          hi all! does anyone knows if there is a "strong" specification on sending numeric data using TCP/IP protocol? Do i HAVE TO send any integer in my structs in any specific byte-order? thanks all! :)

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          If you control both the sending and receiving programs, then no. Bytes are just bytes. Where endian-ness comes into play is when you're using the low-level socket APIs, where the structs require integers to be in network byte order. If you don't control the receiving end, then follow whatever data format it's expecting.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          L 1 Reply Last reply
          0
          • M Massimiliano Conte

            hi all! does anyone knows if there is a "strong" specification on sending numeric data using TCP/IP protocol? Do i HAVE TO send any integer in my structs in any specific byte-order? thanks all! :)

            J Offline
            J Offline
            Jun Du
            wrote on last edited by
            #5

            JonathanLivingstone wrote:

            little indian or big indian?

            I thought you guys are talking about Little India Town, like Little Italy or Korea Town, in Toronto :-D

            Best, Jun

            _ I 2 Replies Last reply
            0
            • J Jun Du

              JonathanLivingstone wrote:

              little indian or big indian?

              I thought you guys are talking about Little India Town, like Little Italy or Korea Town, in Toronto :-D

              Best, Jun

              _ Offline
              _ Offline
              _AK_
              wrote on last edited by
              #6

              And I am still confused.. :-D

              Best Regards, Apurva Kaushal

              1 Reply Last reply
              0
              • M Michael Dunn

                If you control both the sending and receiving programs, then no. Bytes are just bytes. Where endian-ness comes into play is when you're using the low-level socket APIs, where the structs require integers to be in network byte order. If you don't control the receiving end, then follow whatever data format it's expecting.

                --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                L Offline
                L Offline
                led mike
                wrote on last edited by
                #7

                uh? endianness is a platform issue not an application "control" issue. :confused:

                "Alot of the people on this forum are incredibly stupid, thinking that the internet is real"
                Score: 1.0 in the Soap Box

                led mike

                M 1 Reply Last reply
                0
                • L led mike

                  uh? endianness is a platform issue not an application "control" issue. :confused:

                  "Alot of the people on this forum are incredibly stupid, thinking that the internet is real"
                  Score: 1.0 in the Soap Box

                  led mike

                  M Offline
                  M Offline
                  Michael Dunn
                  wrote on last edited by
                  #8

                  The OP asked whether he has to send his own data in a particular endian order. The answer is no, his data is just bytes to the network stack, endian-ness doesn't enter into play at that high a level.

                  --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                  L 1 Reply Last reply
                  0
                  • M Michael Dunn

                    The OP asked whether he has to send his own data in a particular endian order. The answer is no, his data is just bytes to the network stack, endian-ness doesn't enter into play at that high a level.

                    --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                    L Offline
                    L Offline
                    led mike
                    wrote on last edited by
                    #9

                    Michael Dunn wrote:

                    The OP asked whether he has to send his own data in a particular endian order.

                    I don't know that that is supposed to mean but here is what he asked:

                    JonathanLivingstone wrote:

                    sending numeric data using TCP/IP protocol? Do i HAVE TO send any integer in my structs in any specific byte-order?

                    and the answer is "yes". integers are multi-byte width and therefore byte order is significant for TCP/IP.

                    "Alot of the people on this forum are incredibly stupid, thinking that the internet is real"
                    Score: 1.0 in the Soap Box

                    led mike

                    1 Reply Last reply
                    0
                    • J Jun Du

                      JonathanLivingstone wrote:

                      little indian or big indian?

                      I thought you guys are talking about Little India Town, like Little Italy or Korea Town, in Toronto :-D

                      Best, Jun

                      I Offline
                      I Offline
                      iqazi
                      wrote on last edited by
                      #10

                      u made me laugh..thankss

                      ihtesham

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups