I know basic networking but I am not very good at it. Now I am calculating how many packets will be lost if I use UDP over IPv4. I can assume that the protocol overhead for data sent via UDP over IPv4 is 66bytes. And the data needs to be transmitted in blocks of size 4KB (this is to be the payload size of each packet).

So here is my question:

What does a network packet consists of?

Wikipedia states that

A packet consists of two kinds of data: control information and user data (also known as payload).

So basically, a packet has a header and a trailer with payload data in between.

A packet structure looks like this: Header | Payload | Trailer

So if I want to form a packet, should I include protocol overhead in my calculation?

Packet size = 66bytes (protocol overhead) + 4096bytes (payload) = 4162bytes

Any help would be very much appreciated.

  • You say you want to calculate packets lost, but then go on to task about packet length. Is this because you know the bit error rate, and can use it, and packet length to calculate packet loss rate? If so I recommend making it clear in the question. I only realised why, when asking you why (I had written the start of this comment before realising, so I guess others would have the same or worse problem). – ctrl-alt-delor Jul 27 '14 at 9:37
  • @richard I am doing experiment on the given situation. 4788 MB of data must be transmitted from A to B. As you know, UDP is generally rather unreliable: on average 3.3% of transmitted data packets are lost. Protocol overhead is 66 bytes. So I need to know how to find out the size of a packet first so that I will be able to calculate how many packets will be transmitted. So, should I add overhead to calculate the packet size or do I just need to use payload? – Aung Kaung Hein Jul 27 '14 at 9:49
  • The rate of packet loss can vary: I have used UDP an a dedicated LAN, and got zero loss. On the other hand, if you send it across a very bad network, you could get worse. Bigger packets are more likely to get lost. Smaller packets have more overhead. If you use UDP then you need to add your own protocol to handle packet loss (Or know that you can trust the network layer 100%, to do it for you). – ctrl-alt-delor Jul 27 '14 at 10:03
  • I had some problems understanding this. Thanks for all your explanation @richard. You've been a great help to me. So if lets say, I need to find out how many packets need to be transmitted so that all of the 4788 MB of data is received at B, would it be correct to use this formula? 4788 MB / Packet size which is the sum of overhead and payload (66bytes + 4096bytes) Zero loss in this case. – Aung Kaung Hein Jul 27 '14 at 10:16
  • I calculated in this way: 1 packet has 4162 bytes. So, how many packets will be transmitted for 4788 MB? I got 4162 bytes because I added overhead in my calculation. Or should I just use 4096 bytes without overhead? This is exactly what I want to know. – Aung Kaung Hein Jul 27 '14 at 10:19

To calculate the minimum number of packets needed, to send a given quantity of data (assuming zero losses).

Let Sp be the size of the payload of a packet.
Let St be the total size of the data.
Let Np be the number of packets.

In this case we do not consider the meta data (header/overhead).

Let us consider a physical example.

If we have 1L of water (Vt). We wish to move it using a cup(Vc). So number of times we have to use cup(Nc) is Nc=Vt/Vc.

But which Vc, the cup has two volumes, an internal and an external volume (Vi and Ve). The external volume is how much water would be displace if it had a lid to stop water getting in, or Vi+Vm where Vm is volume of the materials the cup is made of. Vi is more simply the Volume of water that the cup can hold. Which value of Vc should we use? Vc=Ve or Vc=Vi

| improve this answer | |
  • Q: In which parts of the packet would corruption cause it to not be delivered?
  • A: An error in any important part of a packet will cause it to be rejected.
  • Q: What part if a packet is important.
  • A: All of it, or else it would not exist.

Therefore Consider the whole packet: payload, udp, ipv4, network-layer (ethernet, ppp, etc). Note the network-layer may change for different parts of the journey, and there for the length of the packet, but so also will the bit error rate.

| improve this answer | |
  • 1
    > the network-layer may change for different parts of the journey - network-layer change => additional/removed control-information, the packet may get encapsulated within the transport information of an arbitrary network that is relaying it. – Hannu Jul 27 '14 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.