# How to decide which bytes will form a packet ?(computer networks)

In wireless communication , I understand what it means to transmit a "bit" but I wanted to understand what exactly does it mean by a packet .

*******POST EDIT/RECEIVING INITIAL ANSWERS******* I got the following question , which is also there in my comment ,

1. How to decide which bytes should form one packet of data ?
2. What distinguishes one packet from another ?

for the following query

*****EDIT CLOSES HERE ****

There will be a signal of certain frequency, $$\omega$$ which is transmitted .If the amplitude crosses a threshold then it means then we say that a "bit" about the information which is interpreted or encoded by a signal of frequency $$\omega$$ is detected or received . (Please correct me If I am wrong)

Similarly , I would like to understand what exactly a "packet of data" in networking means electronically(logically or physically maybe) . What is the definition of a packet ?

Still if the previous version of this question is required then its in the following link :

https://hastebin.com/tejapuvace.coffeescript

Looking forward to replies , thanks a lot .

• If you look at a WiFi network, or mobile data transmission, it's not "amplitude crosses a threshold" (that's completely outdated), the best description is probably "applied magic". Jan 20, 2019 at 11:28
• Welcome to CS.SE! Please don't use "**** EDIT ***". See cs.meta.stackexchange.com/q/657/755. Thank you!
– D.W.
Feb 21, 2019 at 19:42

As pointed out in the answer by gnasher, a packet is nothing more than a sequence of bits.

The actual transmission depends on the underlying physical medium. In case of wireless networks, we transmit using radio signals or microwave signals or infrared signals.

How do we send information via signals?

We modulate the wave. We take the initial signal, which is just a wave (and contains no data/information) and then somehow combine our information signal with the base signal. This process is called modulation. The result is a signal that can be transmitted via airwaves.

Note that wireless communication is omni-directional. They are propagated in all directions. At the other end there is a receiver which listens for certain waves (say only listens to certain frequencies). The receiver knows which modulation technique was used to combine the carrier(base) signal with the information, and uses an appropriate technique to demodulate the signal to extract the information.

In case of digital signals (sending 0's and 1's), this is known as Discrete Modulation.

How do we distinguish a packet in a signal?

Till now we have established how a stream of bits can be propagated wirelessly. Distinguishing Layer 2 frames / Layer 3 packets / Layer 4 segments is a job for the Router / Computer which uses the receiver.

A simple example.

Say each link-layer frame starts and ends with one zero and six 1's. So the receiver which is constantly listening for airwaves with a certain characteristic (amplitude / frequency / phase / whatever) suddenly encounters a string of bits "0111111101101.....". This is immediately processed as the start of a frame and we keep on reading the signal until we encounter ""....101010111111..."". This is how we know that the frame has ended.

Now note that in the above explanation we skipped over a huge amount of topics. There are multiple digital modulation and demodulation techniques, as well as dozens of protocols that a frame / packet has to follow to be correctly processed by the target even if it is received. The Wikipedia page for Modulation will be a good starting point for further reading.

• Why stopping at 101010111 ? Anything specific about this number , do the first 7 bits as in 011111101101 represent some demarcation signal ? Jan 22, 2019 at 16:41
• Would be highly enlightening if you could extend your answer a bit further from frames to packets .. Jan 22, 2019 at 16:43
• Note that everything I described is just an example. The stop and start sequences were chosen as same and chosen randomly. It depends on the underlying protocol used the Network stack. These are called frame delimiters. Look it up. Jan 22, 2019 at 16:44
• A frame contains a packet. So once we isolate a frame, the frame contains the header and the data part. Simply stripping the header of the frame gives us the payload/data of the frame. This payload is nothing but the packet / datagram / network layer unit. Jan 22, 2019 at 16:45
• And how is it decided that what amount of byte sequence should there be in one packet ? Jan 22, 2019 at 17:03

A packet is a sequence of bytes. Nothing more, nothing less.

When transmitting packets, a signal is formed in such a way that boundaries between packets are easily identified, and that the bytes forming the packets can be transmitted and decoded by the receiver.

Electrical signals at high frequencies must be formed in such a way that they are not damaged during transmission. A digital signal (low signal = 0, high signal = 1) at high frequency has no chance to survive transmission because of higher frequencies added by sharp signal changes.

In addition, information for error detection and correction is added before transmitting and checked + removed after receiving the signal, so a package that is sent cannot only be received, but checked for correctness.

(The actual way the signal is formed will only be known by a handful of highly specialised engineers. It's no secret, just very difficult and not of any interest to most people. As I said in a comment, "applied magic").

• How is it decided that which bytes should be in one packet ? Could you elaborate on the process of formation of packet and designing of signals for easier identification of packets ? Jan 20, 2019 at 18:18
• Electrical signals at high frequencies having no chance to survive during transmission , is it because of destructive interference ? Jan 20, 2019 at 18:27
• It's digital signals, not electrical signals. Digital signals (rectangular shaped) are the sums of huge numbers of higher frequency sine waves. Jan 22, 2019 at 16:20
• But ,what is the reason behind not surviving transmission ? Jan 22, 2019 at 16:37