Asgn 1
Asgn 1
Question (50 Marks) TCP/IP stands for Transmission Control Protocol/Internet Protocol, and it is a suite of
communication protocols used to connect network devices on the internet. Currently, most of us use IPv4 for
addressing within the TCP/IP protocol stack. The stack is typically organized into five layers which are as follows:
1. Application Layer: This layer includes protocols for various applications, such as HTTP, FTP, and SMTP,
enabling user interaction and data transfer.
2. Transport Layer: Here, TCP and UDP operate. TCP (Transmission Control Protocol) ensures reliable
transmission, error checking, and packet sequencing, while UDP (User Datagram Protocol) provides
faster but less reliable communication.
3. Internet Layer: This layer is responsible for logical addressing and routing. The Internet Protocol (IP),
including both IPv4 and IPv6, functions here, breaking messages into packets, each with source and
destination IP addresses.
4. Link Layer: This layer handles the physical transmission of data over network hardware, including
protocols like Ethernet and Wi-Fi.
5. Physical Layer (sometimes included in the Link Layer): This involves the actual hardware connections,
signaling, and transmission mediums.
When a message is sent, TCP divides it into smaller packets. Each packet is assigned a packet number which
allows the receiver to reassemble the original message correctly. This segmentation improves network
efficiency and error management during transmission. You are hired by a leading software house to develop
a data-structures code using C++ for sending and receiving packets. Using the linked list knowledge, create a
link list called packet-list and perform the following operations (within the C++ class):
1. Decompose a new message into packets
2. Display the entire contents of link-list or packet-list
The main function is already written and displayed here. You can infer the function protoypes/signatures
from the main function. The structure of packet is given as follows:
struct Packet
{
int msg_number;
int packet_number;
char data;
Packet* next;
};
class PacketList
{ .......... (to be developed by you/students)
}
Page 1 out of 3
Remember: Each packet can only store 1 character in the data portion. Your code must produce the
following output for the main function given below
int main()
{
PacketList p;
return 0;
}
Page 2 out of 3
Figure 1 - Output of the C++ code that you develop
Page 3 out of 3