1

Application data sent over TCP experiences multiple encapsulations:

  1. The application data is encapsulated within one or many TCP fragments
  2. The TCP fragment is encapsulated within one or many IP datagrams
  3. The IP datagram is encapsulated within an Ethernet frame

It turns out Ethernet frames are sent most-significant byte first, and within each byte, most-significant bit first. What about the multiple encapsulations? Are they performed MSB first or LSB first?

Randomblue
  • 1,165
  • 5
  • 16
  • 33
  • Sounds like homework - why do you need to know? – Chopper3 Oct 19 '12 at 09:23
  • Homework, hehe, no. I'm not a student. I'm trying to optimise sending financial orders using the FIX protocol over TCP. Actually, I'm thinking of writing an FPGA implementation for it. – Randomblue Oct 19 '12 at 09:30
  • In that case you'll want to have the RFPs to hand as they'll be much more precise and useful than just getting someone's answer on here. – Chopper3 Oct 19 '12 at 09:31
  • Of course! But before I enbark into this level of detail, I just wanted a "high-level" idea of how encapsulation works so that I can determine straight-away if my optimisation idea works in theory or not. – Randomblue Oct 19 '12 at 09:34
  • 1
    Implementing the protocol in an FPGA, eh? Zow. Skynet really wants those bits to move fast (and it knows how to motivate humans to help it)... – Evan Anderson Oct 19 '12 at 10:54

2 Answers2

3

First, one correction: IP datagrams are not sent within one or many Ethernet frames. One IP datagram is sent within exactly one Ethernet frame. The other stipulations in your description are true, although TCP tries hard to choose the segment size to that one TCP segment does not have to be fragmented into multiple IP datagrams.

All of the protocols in the TCP/IP suite use what's known as network byte order, which is the same thing as big endian, which is the same as MSB first.

TCP and IP do not really deal with things as the bit level, only at the byte level. So they are subject to whatever the physical layer (be it Ethernet or a serial link or something else) does with the bits.

Celada
  • 6,200
  • 1
  • 21
  • 17
1

Virtually everything in IP and its related protocols is most significant byte first. In older documents, such as the RFCs you should be reading, you will see this referred to as "network byte order".

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972