Question

A network protocol contains a four-byte integer, specifying the length of the payload in the packet....

A network protocol contains a four-byte integer, specifying the length of the payload in
the packet. The implementation of this protocol has a mistake in it. When a packet is
received, the protocol implementation needs to copy the payload to a buffer. It first copies
the length field from the packet header to a variable, but the program forgets to convert
the number into the host order. Assume the value of this variable is X. The program then
allocates X bytes of memory to hold a copy of the payload. On a Little-Endian machine,
if the payload of a received packet is 255 bytes, how much memory will be allocated?
What is a likely consequence of this mistake?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since the host machine works on little-endian system, it will store the length in reverse order.

Thus 255 Bytes which could be written as 000000FF in hexadecimal form will be the stored in payload length field at sender side. But at receiver side this field gets stored in reverse order in variable x.

x = FF000000

= 2^32 - 2^24 B

= 4080 MB

= 4 GB(approax)

Hence the host machine will end up allocating approaximately 4 GB memory for a payload of size 255 B.

This will lead to wastage of memory as payload occupies only 255 B , remaining memory is not useful.

Add a comment
Know the answer?
Add Answer to:
A network protocol contains a four-byte integer, specifying the length of the payload in the packet....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answer the following questions about layered protocol models. Consider the 5-layer Internet Protocol Stack. The layers...

    Answer the following questions about layered protocol models. Consider the 5-layer Internet Protocol Stack. The layers from top to bottom are application, transport, network, link, and physical. All layers use headers and the transport layer also uses a trailer. Sketch a packet showing headers and trailers. Assume another protocol stack that uses variable length packets of maximum payload size 250 bytes. In addition to the payload, there are 20 bytes of network-layer header, 20 bytes of transport-layer header, and 10...

  • QUESTION 1 "A single router is transmitting packets, each of length L bits, over a single...

    QUESTION 1 "A single router is transmitting packets, each of length L bits, over a single link with transmission rate R Mbps to another router at the other end of the link. Suppose that the packet length is L= 12000 bits, and that the link transmission rate along the link to router on the right is R = 1000 Mbps. What is the maximum number of packets per second that can be transmitted by the link (use a whole number)?"...

  • In this lab, we’ll investigate the 802.11 wireless network protocol. Follow the instructions and answers questions...

    In this lab, we’ll investigate the 802.11 wireless network protocol. Follow the instructions and answers questions 7 - 10. http://gaia.cs.umass.edu/wireshark-labs/wireshark-traces.zip In this lab, we'll investigate the 802.11 wireless network protocol. Before beginning this lab, you might want to re-read Section 6.3 in the text. Since we l1 be delving a bit deeper into 802.11 than is covered in the text, you might want to check out "A Technical Tutorial on the 802.11Protocol," by Pablo Brenner (Breezecom Communications) http://www.sss-mag.com/pdf802_11tut.pdf, and "Understanding...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT