# Data Link Layer ###### tags: `computer network` ## Functioanlity of Link Layer The Link Layer is more focus on node-to-node transmisission via link. To put it another way, it is responsible for data transfer between two adjacent machine ## Service ### Reliable Delivery | | unacknowledged connectionless | acknowledged connectionless | acknowledged connection | | -------------------- | ----------------------------- | --------------------------- |:----------------------- | | establish connection | no | no | yes | | ack frame | no | yes | yes | ### Framing #### Frame Count - Bad Approach Add at the number of bytes at the front for a fram at the begining ![](https://i.imgur.com/Ss8xlMR.png) #### Byte Stuffing Add falg at start and the end more info on [here](https://www.tutorialspoint.com/what-is-byte-stuffing-in-computer-networks) #### Bit Stuffing Each frame ends with start and end of a pattern, and if message have the pattern, use the following approach: ![](https://i.imgur.com/f7yMQqK.png) ![](https://i.imgur.com/0tN29PN.png) ### Flow Control Set rules for sender to send frame (avoid frame loss) ### Error Control #### Terminology A codeword is the message + the redundant check bit A code is a collection of code Hamming distance d of a code is the smallest hamming distance among all valid codeword With a code of Hamming distance d: • We can detect d-1 single-bit errors • We can correct (d-1)/2 single-bit errors #### Hamming Code : Error Detection and Correction see slide #### CRC: Error Detection [reference](https://www.youtube.com/watch?v=A9g6rTMblz4&list=PLBlnK6fEyqRgMCUAG0XRw78UA8qnv6jEx&index=48&ab_channel=NesoAcademy)