Objectives: Students should be able to —
- 1 Describe how data is broken up into data packets before transmission.
- 2 Show the understanding of "the structure of data packets" (header, payload and trailer).
- 3 Show the understanding of "packet switching" (including the role of the router in the process).
- 4 Identify and describe the methods of data transmission (serial, parallel, simplex, half-duplex and full-duplex).
- 5 Describe the Universal Serial Bus (USB).
Data Packets
(a) Data Packet:
- A data packet is a small segment of a large data file which is to be sent over a computer network (also called a datagram).
- Each packet can be sent along different routes to its destination, if a particular route is very busy or fails.
- All data packets need to be reassembled in the correct order once they reach their destination.
(b) Structure of a data packet:
- Each packet is made up of three parts: header, payload and trailer.
- Header: contains IP address of origin, destination and other information like sequence number and total number of packets.
- Payload: carries the actual data which is to be transported.
- Trailer: contains information that marks the end of the packet.
Figure: Data Packet Structure — Header | Payload | Trailer.
- Header: IP address of the source device (sender), IP address of the destination device (receiver), sequence number of the packet (allowing correct reassembly), size of the packet (in bytes).
- Payload: The actual data in the packets (~64 KiB).
- Trailer: Method of identifying the end of the packet; some form of error checking to ensure packet arrives error-free.
(c) Three components of the header:
- The IP Address of the sending device.
- The IP Address of the receiving device.
- The sequence number and total number of the packets — this is to ensure that all the packets can be reassembled into the correct order once they reach the destination.
- The size of the packet (in bytes).
(d) Payload and Trailer:
(1) Payload:
- Payload refers to the actual data being transported by the packet (usually about 64 KiB).
- The payload is the only data collected for processing, after removing the header and trailer from the packet when it reaches the destination.
(2) Trailer:
- Trailer contains few bits of information that marks the end of packet. It allows each packet to be separated from each other.
- It also contains an error checking protocol called Cyclic Redundancy Check (CRC) which enables the computer to check if all the packets were received without error.
- Packet switching is a method of data transmission in which a large file is broken up into a number of data packets.
- Each packet is then sent independently in a different path to its destination, moving from one router to another. So, the journey time of each packet will be different.
- Once all the data packets reach their destination, they are reassembled in the correct order.
- If the data is received without error, then a confirmation message is sent to the sender; otherwise, the receiver requests to re-transmit the data.
- The data file to be sent is split into chunks that are packaged in specially formatted units called packets.
- Each packet contains a header (with IP address of sender and receiver, sequence number), payload (actual data) and trailer (end mark of packet).
- Packets are sent through the network, moving from one router to another, taking different paths.
- If the data has been received without any error, then the receiver sends a confirmation message to the sender.
- If no confirmation message is received, the sender retransmits the data again.
Diagram: Computer 'A' — Routers R1 to R10 (network nodes) — Computer 'B'. Multiple possible paths between A and B.
(a) How packet switching works for a 500 KiB file:
- The file of size 500 KiB would be broken up into 8 chunks (of about 64 KiB size) called packets. Packet switching allows packets of variable length (7 × 64 KiB + 1 × 52 KiB).
- Each packet from computer 'A' will take a different path, moving from one router to another (e.g. Router-A, R2, R5, R8, R7, R4, Router-B) to reach its destination computer 'B'.
- Each router will determine the shortest possible route for each packet, depending on the number of packets waiting to be processed at each node.
- Packets can reach the destination in a different order to that in which they were sent.
- At the destination, the packets will need to be reassembled into their correct order using the information sent in the header.
(b) Why data packets need to be reassembled at computer 'B':
- Packets would reach the destination computer 'B' in a different order than the order in which they are sent from computer 'A'.
- So, once all the packets arrive at their destination computer 'B', they have to be re-ordered in the correct sequence.
- All packets have to be assembled into one unit equivalent to the original data file by removing the header and trailer from each packet.
(a) Benefits of packet switching:
- Packets can be sent along different routes; no need to rely on a single communication line.
- It is possible to overcome busy or faulty lines by simply re-routing packets.
- It allows simultaneous usage of the same channel by multiple users.
- A high data transmission rate is possible.
(b) Disadvantages of packet switching:
- Packets can be lost and need to be re-sent.
- There is a delay at the destination while the packets are being re-ordered.
- The method is more prone to errors with real-time streaming (like high quality voice calls).
- They require complex protocols for delivery.
(c) Bouncing and Hopping:
(i) Problems caused by data packet 'bouncing':
- Bouncing refers to the transfer of a data packet from router to router and not being able to locate its final destination.
- Data packets that bounce around too many times may get lost.
(ii) How Hopping prevents data packets being lost due to bouncing:
- Hopping is a method to overcome the bouncing problem, where a hop number is added to the header of each packet, and this number is reduced by 1 every time it leaves a router.
- Each packet has a maximum hop number to start with. Once a hop number reaches zero and the packet hasn't reached its destination, then the packet is deleted when it reaches the next router.
- The missing packets will then be flagged by the receiving computer and a request to re-send these packets will be made.
Figure: Hop numbers between routers — Router 3 → Router 5 → Router 8 → Router 11 → Router 15 → Router 21 (with hop numbers decreasing 10, 9, 8, 7, 6, 5).
(a) Cyclic Redundancy Check (CRC):
- CRC is an error-checking method, where the sender adds up all the 1-bits in the payload and stores it as a hex value in the trailer before transmission.
- Once the packet arrives, the receiver recalculates the number of 1-bits in the payload and compares it with the received hex value in the trailer.
- If it matches, then the data received is considered error-free; otherwise, a request for re-transmission is made.
(b) Verifying the payload is error-free:
The payload contains:
- Count the number of 1-bits in the payload. The sum of all the 1s is 29.
- Convert denary 29 into hexadecimal, which is 1D.
- If the trailer of the received packet contains the hex value 1D, then the data received is considered error-free.
Diagram: Delegate 1 in USA ⇄ Delegate 2 in India (Video and sound sent between delegates using packet switching).
(a) Potential problems with sound and video quality:
- Packet switching allows equal sharing of bandwidth but cannot guarantee the quality or latency (delay in communication) of the data for real-time streaming.
- Packet loss occurs when one or more transmitted data packets fail to arrive at their destination.
- If packet loss rate is high or there is high latency, it can cause delays to be worse for real-time streaming applications like voice and video.
- The user may experience disruptions, such as slow service or loss of network connectivity that affects the sound and video quality.
(b) How these problems could be caused:
- In packet switching, the data packet could move from router to router and not be able to locate its final destination.
- Data packets that bounce around too many times may get lost.
- Packet loss is typically caused either by errors in data transmission or network congestion.
(c) Dealing with lost packets:
- A hop number is added to the header of each packet, and this number is reduced by 1 every time it leaves a router.
- Once a hop number reaches zero and the packet hasn't reached its destination, then the packet is deleted.
- And a request for retransmission of the packet is made.
(d) How packet switching might improve data security:
- Packet switching uses Cyclic Redundancy Check (CRC) to detect errors in transmitted data packets and requests to resend the faulty packets.
- It allows resending of lost data packets.
- Packet switching is more reliable because it ensures that packets reach their destination.
Modes of Data Transmission: Simplex, Half-duplex & Full-duplex
Mode of data transmission refers to the direction of the flow of data, whether in one direction only or in both directions.
Simplex:
Simplex data transmission allows data to flow in one direction only, that is, from sender to receiver only.
Example: Sending data from a computer to a printer.
Diagram: Mainframe → Direction of data → Monitor.
Half-duplex:
Half-duplex data transmission allows data to flow in both directions but not at the same time.
Example: Walkie-talkie conversation where only one person speaks at a time.
Diagram: Two workstations; at time 1 data goes right, at time 2 data goes left.
Duplex (Full-duplex):
Full-duplex data transmission allows data to flow in both directions simultaneously at the same time.
Example: Telephony (VoIP Call) and Video chatting.
Diagram: Two workstations with bidirectional arrows labeled "Direction of data all the time".
Types of Data Transmission: Serial & Parallel
- Transfer of data bits, one bit at a time, sequentially over a single communication line or wire.
- Data arrives at its destination fully synchronised in the correct order.
- Serial data transmission works well over long distances.
- Data is transmitted at a slower rate than parallel because it uses only one wire or channel.
Diagram: Sender (CPU) → Parallel-to-Serial Converter → Single Communication Line (MSB→LSB, e.g. 1 0 1 0 0 1 1 0) → Serial-to-Parallel Converter → Receiver (CPU).
- Transfer of data bits, several bits at a time (usually 8-bits), simultaneously over separate communication lines or wires.
- Over longer distances, data can become skewed or unsynchronised.
- Parallel data transmission works well over short distances.
- Internal circuits of a computer use parallel transmission because it is faster than serial, as it uses multiple wires or channels.
Diagram: Sender box — eight separate red lines (eight bits sent together, eight wires needed) — Receiver box.
- Serial communication transfers one bit at a time. Parallel communication transfers multiple bits at a time (usually 8-bits).
- Serial transmits bits of data sequentially. Parallel transmits bits of data simultaneously.
- Serial transmission is slower than Parallel.
- Serial communication port requires a single data wire. Parallel communication port requires multiple wires.
| Advantages | Disadvantages |
|---|---|
| Reduces the cost as it uses a single wire. | Serial transmission is slower than parallel. |
| Perfect for transmitting over longer distances as there are no synchronisation issues. | Use of conversion devices at source and destination may increase the cost (to convert parallel to serial and vice versa). |
| It has less chance of data being distorted or skewed. | It occupies 20% of overhead additional data than useful information, leading to wastage of bandwidth. |
| Advantages | Disadvantages |
|---|---|
| Parallel transmission is faster than serial. | It is costly as it requires multiple wires. |
| It is ideal for transferring data over short distances. | Data could be out of synchronisation, skewed or distorted when transmitted over long distances. Cross-talk between parallel lines of wires is possible. |
- Data transmission between computer and peripheral device using USB (Universal Serial Bus) Cable.
- Connecting hard disk to the motherboard using SATA (Serial Advanced Technology Attachment) cable.
- Connecting computer to the modem using Serial COM port.
- Wireless WiFi or Bluetooth connection uses serial transmission.
- Data transmission within CPU between registers using data, control or address bus.
- Data transmission between CPU (Microprocessor) and RAM chip.
- Connecting hard disk to the motherboard using PATA (Parallel Advanced Technology Attachment) cable.
- A single wire reduces cost.
- A single wire means that there is less chance of interference or cross-talk.
- In a single wire, data bits will not get skewed or out of synchronisation.
Universal Serial Bus (USB)
(a) Describe USB:
- USB is an external bus with a plug-and-play interface.
- It is used to connect external peripheral devices with a computer.
- It uses asynchronous serial data transmission. Allows both half-duplex and full-duplex.
- It provides power supply to the peripheral devices.
The USB cable consists of a four-wired shielded cable, with two wires for power (red and black). The other two wires (white and green) are for data transmission.
Diagram (USB cable internal wires): Red (+5V) · White (Data+) · Green (Data−) · Black (Ground) · Shield (no connection at USB device).
(b) Three reasons of using USB ports over traditional Serial ports:
- Data transfer rate of USB port is much higher (12 Mbps to 480 Mbps) than traditional Serial port (1 Mbps to 10 Mbps).
- USB port is capable of supplying power to the peripheral devices.
- USB port automatically detects the device and installs the correct driver.
- USB ports are much more durable than serial ports because pins in serial ports are very easy to bend or break, whereas USB pins are more robust and much more difficult to damage.
Benefits:
- Automatically detects and installs the appropriate device drivers.
- USB cables can only fit in one way that prevents incorrect connections.
- USB supports different data transmission rates (from 1.5 Mbps to 5 Gbps).
- No need for external power supply since cable supplies +5V power.
- USB protocol re-transmits data if any errors are detected; this leads to error-free data transmission.
- USB connections can transfer data using half-duplex or full-duplex.
- It is relatively easy to add more USB ports if necessary, by using USB hubs.
- USB is backward compatible (that is, older versions are still supported).
- USB has become an industry standard, which has replaced most serial ports in consumer-grade computing equipment.
Drawbacks:
- Standard USB only supports a maximum cable length of 5 m, beyond that, USB hubs are needed to extend the cable length.
- USB ports can transmit data only over short distances, beyond which you will need to use USB hubs.
- Data transmission rate of even the latest version USB V3 and V4 is much lower than FireWire and Ethernet Interfaces.
- The USB port provides power supply to the device, to activate and communicate with the computer.
- The OS (operating system) sends a request to the USB port to identify the device.
- The unique vendor-id, serial number and type of the device stored in the device descriptor is sent to the OS.
- The OS compares the information of the device descriptor with the descriptor of the vendor-specific device driver installed with the OS.
- If it matches, then it will load the device driver automatically.
- If it doesn't match, then OS will ask the user to install the driver software for that device.
The three default or standard formats of USB port or connectors found in desktop or laptops are:
USB-A:
- The most common rectangular connector that only fits in one way.
- Most portable storage devices use the USB-A connector.
- It is primarily used on host computers and hubs. You won't find cables with USB-A on either end. In fact, connecting two computers with a USB-A cable could damage them both.
Diagram (USB-A connector pins): Power · Data− · Data D+ · Power +5V.
USB-B:
- This is an older connector, almost square at one end, designed for USB peripherals such as a printer, upstream port on a hub, or other larger peripheral devices.
- It is designed to allow the connection of peripheral devices without running the risk of connecting two host computers to one another.
Diagram (USB-B connector pins): Power +5V · Data D− · Data D+ · Power (Ground).
USB-C:
- It is the latest USB standard, which is a 24-pin connector that can fit into a USB-C port in either way round.
- It is much smaller and thinner than older USB connectors.
- It offers 100 watt (20 volt) power connectivity, which means full-sized devices can now be charged.
- It can carry data at 10 gigabits per second and can support DisplayPort and HDMI mode to transfer video and audio signal.
- USB-C is backward compatible (to USB 2.0 and 3.0) and is expected to become the new industry standard (universal) format.
Asynchronous & Synchronous Transmission
Asynchronous transmission:
- Asynchronous data transmission refers to the data being transmitted in an agreed bit pattern, grouped together with the start and end control bits.
- The receiver detects the start and end bit of the data to know when the data starts and when it ends.
Diagram (Asynchronous): Sender → [Stop Bit | Data (e.g. 1011001) | Start Bit] → Receiver, with control bits around each data group.
Example:
- Data transmitted from satellite to the earth station.
- Discussion forums and email where sender and receiver need not be present at both ends at the same time.
- MIDI music file uses asynchronous protocol to play musical instruments.
Synchronous transmission:
- Synchronous data transmission is a continuous streaming of data included with a timing signal generated by an internal clock to ensure that the sender and receiver are synchronized with each other.
- Synchronous data transmission is faster than asynchronous and is used where speed is an important issue.
Diagram (Synchronous): Sender → [Frame] [Frame] [Frame] … → Receiver, with clock time signals between each frame.
Example:
- VoIP (Telephony) and Video calls.
- Network communication.
- Playing online games.
- The receiver detects the start and end bit of the data to know when the data starts and when it ends.
- Without these control bits, it would be impossible to separate groups of data as they arrive.
- This prevents data becoming mixed up.
(a) Ensure data arrives correctly using Synchronous transmission:
- Transmits data in a continuous stream included with timing signals generated by an internal clock.
- The receiver counts how many bits were sent and then reassembles them into bytes of data with accurate timing.
- This ensures that the sender and receiver are synchronized with each other.
(b) Advantage and disadvantage of Synchronous transmission:
Advantage: Much faster data transmission rate than asynchronous.
Disadvantage: If the timing is not accurate, data will be out of synchronisation.
| Asynchronous | Synchronous |
|---|---|
| Transfer of data with start and stop bits; that allows the receiver to know when it starts and ends to reassemble the data. | Transfer of data included with timing signal; the receiver counts how many bits were sent over a period of time and reassembles them. |
| Timing is not important. | Timing is important. |
| Sends 1-byte or a single character at a time with variable gaps between each data unit. | Sends several bytes of data in the form of blocks or frames; as continuous stream without gaps between them. |
| Occur at different times and at different places. | Occur at the same time but at different places. |
| Sender and receiver need not be active during transmission. If receiver is not there while sending data, data will be put in queue. | Sender and receiver need to be active during transmission. Receiver must be there to receive data in real-time. |
| Can use both forward and backward error correction method. | Can only use forward error correction method, not backward error. |
Figure: Data Transmission tree — Data Transmission → { Parallel (always Synchronous) ; Serial → { Synchronous ; Asynchronous } }.
Revision: Statements and Key Computing Terms
| Key Term | Statement |
|---|---|
| Data packet | A small part of a message/data that is transmitted over a network; after transmission all the data packets are reassembled to form the original message/data. |
| Packet header | The part of the data packet that contains the IP addresses of the sender and receiver, and includes the packet number which allows reassembly of the data packets. |
| Packet trailer (or footer) | The part of a data packet that indicates the end of the data packet and cyclic redundancy check error check. |
| Payload | The actual data being carried in a data packet. |
| Node | Stages in a network that can receive and transmit data packets; routers are nodes in communication networks. |
| Packet switching | A method of transmission in which a message is broken into many data packets which can then be sent along pathways independently of each other. |
| Router | A device that enables data packets to be moved between different networks, for example to join a LAN and a WAN. |
| Real time streaming | The transmission of data over a network for live events where the data is sent as soon as it is received or generated. |
| Hopping / hop number | A number in a data packet header used to stop data packets that never reach their destination from 'clogging up' the data paths/routes. |
| Simplex | Data that can be sent in one direction only. |
| Half-duplex | Data that can be sent in both directions but not at the same time. |
| Full-duplex | Data that can be sent in both directions at the same time simultaneously. |
| Serial data transmission | Sending data down one channel/wire one bit at a time. |
| Parallel data transmission | Sending data down several channels/wires several bits at a time (usually 1 byte). |
| Skewed (data) | Data that arrives at the destination with the bits no longer synchronised. |
| Universal Serial Bus (USB) | A type of serial data transmission which has become the industry standard for connecting computers to devices via a USB port. |