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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education