When transmitting a file or data from one device to another, the data must be sent as quickly as possible whilst maintaining data integrity. If the data is transmitted as a block or in its entirety, it can take time before the recipient receives it. Breaking the data into smaller “chunks” allows it to be transmitted faster from the sending device to the receiving device. These smaller chunks are known as data packets or simply packets.
A packet is a small unit of data that can be transmitted from a sending device to a receiving device via a network communication protocol.
Because each packet is a small fixed portion of a data item, there must be some way of identifying it on the network. For example, you need to know where the packet is coming from, where it is going, and the message it carries. Generally, a packet consists of three major parts. These are:
Packet header
Payload
Trailer
The header of a packet contains information used by routers to determine the source and destination of a packet. The information inside the header is also essential to reconstructing the original message at the receiving device when multiple packets are received.
Examples of data found in the header of a packet include:
The IP address of the sending device
The IP address of the receiving device
Packet number (to indicate the position of each packet in the original message)
The payload is the part of a data packet that carries the actual message to the intended recipient. However:
the message delivered via a packet is incomplete as it is a fragment of the original message.
it will take several messages from multiple packets to reconstruct the original message.
the packets must be rearranged in the same order they left the sender’s computer.
Each packet is identified by the packet number found in the packet header.
Arranging the packet numbers will eventually cause the message fragments to be in order, and the original message would have been reconstructed.
On the other hand, the trailer is the part of the packet that contains information that tells the receiving device that the end of the packet has been reached and should not expect any more bits to be transmitted for that packet.
A number of methods can be used to transmit data from the sending to the receiving computer. One of these methods is known as Packet Switching. In this method, data is broken down into smaller chunks (packets) and sent to the destination computer. Each packet is sent via a different route to its destination and may arrive at its own time.
Several factors can determine the route that a packet takes on its way to its destination. These may include the route availability, e.g. is there congestion (i.e., too many existing packets on the route?). It can also be that an error is detected, so the packet has to be resent and may take a different route the second time. When the packets arrive, they may be out of order due to delays in their respective routes. They will need to be re-ordered to reconstruct the original message or data. This is where the packet number becomes helpful to determine a packet's original position in the original message.
To summarise, in packet switching:
data is broke down into packets
each packet could take a different route
a router controls the route a packet takes
packets may arrive out of order
once the last packet has arrived, packets are reordered
When data is sent from one device to another, we say that we are transmitting data.
For data transmission these factors are considered:
The direction of the data transmission (one direction only or both at the same time)
How many bits are sent at the same time.
Simplex data transmission is in one direction only.
Examples, data sent from: a microphone to a computer, a sensor to a computer, computer to speaker, computer to monitor, webcam to computer.
Half-duplex data transmission is in both directions but not at the same time.
Example: walkie-talkie.
Full-duplex data transmission is in both directions simultaneously.
Examples: telephone call, VOIP (Voice over the Internet Protocol (Skype)), video conferencing, instant messaging.
Serial data transmission is when data is sent, one bit at a time, over a single wire or channel (bits are sent one after the other in a single stream). Bits can be transmitted as simplex, half-duplex or duplex.
This method of transmission works well over long distances. However, data is transmitted at a slower rate than parallel data transmission.
Using a single wire there is less chance of interference, so little or none data corruption occurs.
Using a single wire reduces costs.
Bits will still be synchronised after transmission.
Example, sending data from a computer to a modem for transmission over a telephone line.
Parallel data transmission is when several bits of data (usually 1 byte) are sent down several wires or channels at the same time; one wire or channel is used to transmit each bit.
This method of transmission works very well over short distances (over longer distances, the bits can become skewed, which means they will no longer be synchronised).
This method is faster than serial data transmission.
Parallel data transmission is used in the internal electronics of the computer system. The pathways between the CPU and the memory all use this method of data transmission. Integrated circuits, buses and other internal components all use parallel data transmission because of the need for high speed data transfer.
Example, sending data to a printer from a computer using a ribbon connector.
This video explains in graphical detail the differences between serial and parallel data transmission.
An integrated circuit (IC) is an electronic chip where electronic parts such as resistors, transistors and capacitors are connected as part of the circuit board.
An Integrated Circuit (aka chip, microchip) uses parallel data transmission for sending data internally. For example, the CPU is an integrated circuit which uses parallel data transmission to send data.
There are many interfaces that a computer uses for communication with external devices. An interface is a shared boundary or place where devices can link up and share information. An Ethernet port, firewire and USB are among some of these interfaces. Universal Serial Bus (USB) is a communication interface that has become a standard for connecting devices to their parent or host controllers. A host controller is a circuitry device that allows external devices such as memory sticks to be connected to a computer. You can think of it as a hardware device that will enable you to connect your peripheral device to your computer so that your device can exchange data with the computer.
USB uses serial transmission, meaning data is sent through a wire one bit at a time.
Essentially, the USB cable consists of:
a four-wire shielded cable.
two of the wires are used for power and the earth.
two of the wires are used in the data transmission.
When a device is plugged into a computer using one of the USB ports:
the computer automatically detects that a device is present (due to a small change in the voltage level on the data signal wires in the cable)
the device is automatically recognised, and the appropriate device driver is loaded up so that computer and device can communicate effectively.
if a new device is detected, the computer will look for the device driver which matches the device, if this is not available, the user is prompted to download the appropriate software.
Errors can occur during data transmission due to interference, e.g. data loss, data gain and data change.
Parity checks
PARITY CHECKING is one method used to check whether data has been changed or corrupted following transmission from one device or medium to another device or medium. A byte of data, for example, is allocated a PARITY BIT. This is allocated before transmission takes place. Systems that use EVEN PARITY have an even number of 1- bits; systems that use ODD PARITY have an odd number of 1-bits. Consider the following byte:
1 1 0 1 1 0 0
If this byte is using even parity, then the parity bit needs to be 0. If odd parity is being used, then the parity bit needs to be 1 to make the number of 1-bits odd. Therefore, the byte just before transmission would be: either
0 1 1 0 1 1 0 0 (even parity)
or
1 1 1 0 1 1 0 0 (odd parity)
Activities:
Find the parity bits for each of the following bytes:
a. 1 1 0 1 1 0 1 even parity used
b. 0 0 0 1 1 1 1 even parity used
c. 0 1 1 1 0 0 0 even parity used
d. 1 1 1 0 1 0 0 odd parity used
e. 1 0 1 1 0 1 1 odd parity used
If a byte has been transmitted from ‘A’ to ‘B’, and even parity is used, an error would be flagged if the byte now had an odd number of 1-bits at the receiver’s end.
0 1 0 1 1 1 0 0
0 1 0 0 1 1 0 0
In this case, the receiver’s byte has three 1-bits, which means it now has odd parity whilst the byte from the sender had even parity (four 1-bits). This clearly means an error has occurred during the transmission of the data. The error is detected by the computer recalculating the parity of the byte sent. If even parity has been agreed between sender and receiver, then a change of parity in the received byte indicates that a transmission error has occurred.
Activities
Which of the following bytes have an error following data transmission?
a. 1 1 1 0 1 1 0 1 even parity used
b. 0 1 0 0 1 1 1 1 even parity used
c. 0 0 1 1 1 0 0 0 even parity used
d. 1 1 1 1 0 1 0 0 odd parity used
e. 1 1 0 1 1 0 1 1 odd parity used
In each case where an error occurs, can you work out which bit is incorrect?
Limitations of parity checks
As much as they can tell us whether the number of bits in a given binary number is even or odd, they cannot tell us exactly which bit has been corrupted or changed during transmission. An example is:
Luis sent a byte data to Celia using odd parity. Determine whether the byte was transmitted correctly.
Luis sends: 00111011
Celia receives: 10111001
You can see that the odd parity check suggests the byte was correctly transmitted. This is because the total number of 1s in both the sent and received byte is odd. However, we can see that the bits are changed. Parity check has no way to detect this error.
To detect these corrupt bits, you have to send the byte as a parity block.
Parity block
It checks for errors in an entire block of bytes.
Example:
At the transmitting end, a program reads a group of seven bytes. The data is represented by seven bits for each byte. The most significant byte, bit 7, is undefined so we have left it blank.
___ 1 0 1 0 0 1 1
___ 0 1 1 0 0 0 1
___ 1 0 1 1 0 0 0
___ 0 0 1 1 1 0 0
___ 0 1 1 0 0 1 0
___ 0 1 1 0 0 0 1
___ 0 1 1 0 0 0 1
The parity bit is set for each of the bytes. The most significant bit is set to achieve even parity.
Parity
bits
0 1 0 1 0 0 1 1
1 0 1 1 0 0 0 1
1 1 0 1 1 0 0 0
1 0 0 1 1 1 0 0
1 0 1 1 0 0 1 0
1 0 1 1 0 0 0 1
1 0 1 1 0 0 0 1
An additional byte is then created and each bit is set as a parity bit for the bits at that bit position. This includes counting the parity bits in the seven bytes containing data.
Parity
bits
0 1 0 1 0 0 1 1
1 0 1 1 0 0 0 1
1 1 0 1 1 0 0 0
1 0 0 1 1 1 0 0
1 0 1 1 0 0 1 0
1 0 1 1 0 0 0 1
1 0 1 1 0 0 0 1
0 0 0 1 0 1 0 0 Parity byte
The program then transmits the 8 bytes in sequence.
At the receiving end, a program takes the eight bytes as input and checks the number of ones for the individual bytes and for the bit positions.
Checksum
CHECKSUM is another way to check if data has been changed or corrupted following data transmission. Data is sent in blocks and an additional calculated value, the checksum, is also sent at the end of the block of data. The receiver will perform a similar calculation on the data to generate its checksum. After that, it will compare the two checksum values, and if there is a mismatch, then an error would have occurred. If there is an error, the receiver will request to the sender to resend the data. This process is repeated until the correct data is received.
How to calculate a checksum
Data is sent in blocks and each block is made up of several bytes of data. The highest possible denary value that can be represented in 1 byte (8 bits) is 2^8 - 1 = 255.
A few rules to follow when calculating checksum are shown below:
Rule 1: if the sum of the bytes in the block is less or equal to 255, then this value is taken as the checksum.
Rule 2: if the sum of the bytes in the block is greater than 255, the following rules should be taken:
divide the sum of the bytes in the block by 256.
convert the result above to an integer
multiply the result by 256
subtract the results from the sum of the bytes
Rule 3: the result is the checksum of the block
Example 1
We want to transmit the following block of bytes:
0 0 1 1 0 0 0 0
0 0 0 0 1 0 1 0
Adding both bytes we get:
0 0 1 1 1 0 1 0 which is equivalent to 58.
58 is less than 256, then the check sum for the given block of bytes is 58.
Example 2
We want to transmit the following block of bytes
1 0 1 1 1 1 1 1
0 1 1 1 0 0 0 0
0 1 0 1 0 0 0 0
Adding all the bytes we get,
1 0 1 1 1 1 1 1 1 which is equivalent to 383 which is greater than 256. We need to follow rule 2 (see the rules above)
divide the sum of the bytes in the block by 256.
383/256 = 1.486
convert the result above to an integer
1
multiply the result by 256
1 * 256 = 256
subtract the result from the sum of the bytes
383 - 256 = 127
The checksum is 127.
Echo check
An echo check is a method of error detection where the receiver sends back a copy of the data it has received to the sender. The sender compares the data it originally sent with the data it has received. If there is a match between the two data sets, then the transmission took place without error. If there is an error, the sending computer resends the data, and the process starts all over again. One important thing to note with echo check is that the sending computer performs error checking and not the receiving computer. The disadvantage of echo check is that it is difficult to tell whether the data got corrupted in transit to the destination computer or on its way back.
Check digits
A CHECK DIGIT is the final digit included in a code; it is calculated from all the other digits in the code.
Check digits are used for barcodes, product codes, International Standard Book Numbers (ISBN) and Vehicle Identification Numbers (VIN).
Check digits are used to identify errors in data entry caused by mistyping or misscanning a barcode.
They can usually detect the following types of error:
• an incorrect digit entered, for example 5327 entered instead of 5307
• transposition errors where two numbers have changed order, for example 5037 instead of 5307
• omitted or extra digits, for example 537 instead of 5307 or 53107 instead of 5307
• phonetic errors, for example 13, thirteen, instead of 30, thirty.
An example of a check digit calculation is ISBN 13, where the 13th digit of the ISBN code is calculated using the following algorithm.
1 Add all the odd numbered digits together, excluding the check digit.
2 Add all the even numbered digits together and multiply the result by 3.
3 Add the results from 1 and 2 together and divide by 10.
4 Take the remainder, if it is zero use this value, otherwise subtract the remainder from 10 to find the check digit.
Example:
Find the check digit of the following ISBN:
978-1-107-57724-?
1. 9+8+1+7+7+2=34
2. 7+1+0+5+7+4=24*3=72
3. 34+72=106/10=10.6
4. 10-6=4
To check that an ISBN 13 digit code is correct a similar process is followed.
1 Add all the odd numbered digits together, including the check digit.
2 Add all the even number of digits together and multiply the result by 3.
3 Add the results from 1 and 2 together and divide by 10.
4 The number is correct if the remainder is zero.
Activities
a Find the check digit for the ISBN 978190612400.
b Are these ISBNs correct?
i 9718780171500
ii 9781234567897
Automatic Repeat reQuests (ARQ)
It uses an ACKNOWLEDGEMENT (a message sent by the receiver indicating that data has been received correctly) and TIMEOUT (this is the time allowed to elapse before an acknowledgement is received).
If an acknowledgement isn’t sent back to the sender before timeout occurs, then the message is automatically resent.
Encryption is the technique of scrambling data to make it unreadable to the person who doesn't know how to unscramble it. An encryption algorithm is used to encode the data and render it meaningless to someone without a similar algorithm or key to decrypt the data. Encryption is an essential concept of data security in that it gives a sense of security that if a hacker intercepts data, it won't be readable to them.
Text that is not encrypted is known as plain text, while text that has been encrypted is known as cipher text.
A simple example of an encryption method is the Caesar cipher.
Caesar cipher works by taking the message to encode and manipulates it by shifting each letter in the message a given number of positions either to the left or to the right. Like this:
Notice that A is shifted three places to the right and becomes D. Similarly, B and C are moved three places to the right and become E and F, respectively.
Exercise
Using the Caesar cipher encrypt the phrase:
I love seafood
There are two types of encryption algorithms that can be used during data transmission. These are:
Symmetric encryption
Asymmetric encryption
Symmetric encryption
Symmetric encryption is a type of encryption where the key used for encrypting a message is the same one used for decrypting the message. The sending computer must send both the encrypted message and the key but separately. The receiving computer will then use the key it has received to decrypt the message.
The Caesar cipher is an example of symmetric encryption.
The problem with symmetric encryption is that if a malicious user intercepts the key, he or she can read the message.
Asymmetric encryption
In asymmetric encryption, two separate keys are used, a private and a public key.
One of the keys is used for encryption and the other key is used for decryption.
The key used to encrypt a message cannot be used to decrypt the message.
The public key is visible to everybody who wants to exchange an encrypted message. The private key is known only to the computer where it resides (to the owner).
The advantage of asymmetric encryption is that it is reliable compared to symmetric encryption because the person (his device) encrypting the message is the only one with the private key (nobody else has this key) and he does not need to share it as with symmetric encryption.