To allow the exchange of data between two machines, it is necessary to establish a protocol that allows the transfer in a reliable way.
- The source node sends a data frame to the destination node and initializes a countdown clock.
- The destination node receives the packet, recalculates the checksum and compares it with the received one.
- If there was no error, the destination node sends an acknowledgment data frame (ACK).
- If there was an error, it does not send any confirmation frame back.
- If the source node receives an ACK before its clock transfer time expires, it sends the next data frame.
- If the source node does not receive an ACK before the end of the clock, it resends the data frame and resets the clock.
Communication scheme between 2 nodes
Framing Methods
- character count
- It uses a header field to specify the number of characters in the frame, so the destination link layer sees the character count and knows where the end of the frame is, the problem is that the count can be altered by an error in the transmission, the destination will lose sync and be unable to locate the start of the next frame; this method is almost no longer used today.
- Start and end characters with character padding
- This overcomes the synchronization problem after an error, making each frame start with the ASCII character sequence DLE STX and end with the sequence DLE ETX(DLE Data Link Escape; STX Start Text; ETX End Text), like so if the target loses track of the frame boundaries all it has to do is look for the DLE STX or DLE characters to determine them. The problem with this method when transmitting binary data, such as object programs or floating point numbers, it can easily happen that the characters corresponding to DLE STX or DLE ETX get mixed up in the data; To resolve this the link layer inserts an ASCII DLE character just before each "Accidental" DLE character in the data, the receiving link layer removes the DLE before delivering the data to the network layer. The disadvantage is that this technique is tied to 8-bit characters in general and ASSCII code.
- Bit-stuffed start and end flags
- Each frame begins and ends with a special pattern of bits, 01111110 called the indicator byte. each time the transistor's data link layer encounters five 11111s in a row (0) it inserts a zero bit (5) into the bit string. When the receiver sees 11111 consecutive input one bits (0) followed by a padding zero bit (XNUMX). This padding is transparent to the network layer.
Error correction codes
They are strategies that consist of including enough redundant information in each transmitted data block so that the receiver can deduce what the transmitted character should have been.
- n-bit codeword:a frame consists of m bits and r check bits so (n=m+r)
- Hamming distance:is the number of bit positions by which two codewords differ
- parity bit :is chosen so that the number of 1-bits in the codeword is odd or even