Data travels over a network in the form of packets and packets are composed of bytes. Assuming that size of each packet is 8 bytes. For example, if data has 3 packets and starting byte number of packet 1 is 800 than packet 2 will have starting byte number 808 and packet 3 will have starting byte number 816. All the packet numbers have difference of 8, since each packet is 8 bytes. Write C++ functions to handle the following scenario. You are supposed to input number of packets data is divided into (i.e. number packets data has). Declare an array for storing starting byte number of each packet. Input in array the starting byte numbers of each packet in data. After input display one of the following messages. No packet is loss. All received but are not in order. Data corrupted. For example: If data is divided into 4 packets. No packet is loss All received but are not in order.   Data corrupted.     812 820 828 836 By looking at above data we can say all the packets for data is in order and no packet is loss. As each cell has the value that has difference of 8 with other cell and are in order   820 812 828 836 By looking at above data we can say all packets are received but the packet number 812 and 820 are not in order.     812 824 836 828 As each packet consist of 8 byte, there must be difference of 8 in packet number we can see difference between 812 and 824 is of 12 it means data is corrupted.     Note: User can enter any number for packets data is divided into, and any data in array. Assuming that minimum value is for the starting packet number.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.3: Data Types
Problem 9E: (Practice) Although the total number of bytes varies from computer to computer, memory sizes of...
icon
Related questions
Question

Q.No.9.                                                                                                                                                      

Data travels over a network in the form of packets and packets are composed of bytes. Assuming that size of each packet is 8 bytes. For example, if data has 3 packets and starting byte number of packet 1 is 800 than packet 2 will have starting byte number 808 and packet 3 will have starting byte number 816. All the packet numbers have difference of 8, since each packet is 8 bytes.

Write C++ functions to handle the following scenario. You are supposed to input number of packets data is divided into (i.e. number packets data has). Declare an array for storing starting byte number of each packet. Input in array the starting byte numbers of each packet in data. After input display one of the following messages.

  • No packet is loss.
  • All received but are not in order.
  • Data corrupted.

For example:

If data is divided into 4 packets.

No packet is loss

All received but are not in order.

 

Data corrupted.

 

 

812

820

828

836

By looking at above data we can say all the packets for data is in order and no packet is loss. As each cell has the value that has difference of 8 with other cell and are in order

 

820

812

828

836

By looking at above data we can say all packets are received but the packet number 812 and 820 are not in order.

 

 

812

824

836

828

As each packet consist of 8 byte, there must be difference of 8 in packet number we can see difference between 812 and 824 is of 12 it means data is corrupted.

 

 

Note: User can enter any number for packets data is divided into, and any data in array. Assuming that minimum value is for the starting packet number.

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr