Skip to content

nehadhuttargaon313/Error-Detection-Using-CRC-8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CS558 - Computer Systems Lab

Group 18

v.subramanian@iitg.ac.in - Subramanian V
r.sri@iitg.ac.in - Sri Harsha R
d.neha@iitg.ac.in - Neha Dhuttargaon

Assignment 1 : Error Detection using Cyclic Redundancy Code (Using CRC-8)

In this assignment, your aim will be to implement a simple Stop-and-Wait based data link layer level logical channel between two nodes A and B using socket API, where node A and node B are the client and the server for the socket interface respectively. Data link layer protocol should provide the following Error handling technique in Data Link Layer.

  • Error Detection using Cyclic Redundancy Code (using CRC-8 as generator polynomial, i.e. G(x) = x8+x2+x+1

Operation to Implement: Client should construct the message to be transmitted (T(x)) from the raw message using CRC.At the sender side T(x) is completely divisible by G(x) (means no error), send ACK to the sender, otherwise (means error), send NACK to the sender. You must write error generating codes based on a user given BER or probability (random no between 0 and 1) to insert error into both T(x)and ACK/NACK. If NACK is received by the sender, it should retransmit the T(x) again following the above steps. In the client side also implement Timer Mechanism to detect the timeout (in case of error in ACK/ NACK) and retransmit the message T(x) again once time out happens.

You also require implementing a "Concurrent Server", i.e., a server that accepts connections from multiple clients and serves all of them concurrently.

You should accept the IP Address and Port number from the command line (Don't use a hard-coded port number). Prototype for command line is as follows:

Prototypes for Client and Server

Client: <executable code><Server IP Address><Server Port number>
Server: <executable code><Server Port number>

The connection to the server should be gracefully terminated. When the server is terminated by pressingcontrol C, the server should also gracefully release the open socket (Hint: requires use of a signal handler).
*Please make necessary and valid assumptions whenever required.

Steps To Run :

  1. Compile server.c and client.c with crc.c in CRC directory.
    gcc server.c CRC/crc.c -o server
    gcc client.c CRC/crc.c -o client

  2. Prototypes to run programs -
    Server: <executable code> <Server Port number>
    ./server PORT_NO
    Client: <executable code> <Server IP Address> <Server Port number>
    ./client IP PORT_NO

  3. The server spawns a thread for each client request and does blocking read.

  4. For each iteration a random binary string is generated by the client. Based on the BER set, error is introduced in the packet and transmitted to the server.

  5. The thread serving the client at the server end reads the packet and performs CRC check on the same.

  6. Based on the packet loss rate set, server simulates packet loss (No ACK/NACK is sent).

  7. If the message passes CRC check (remainder 0) ACK is sent, else NACK is sent.

  8. Client retransmits the packet if NACK is received or if timeout occurs due to packet loss. If ACK is received, it proceeds to the next iteration.

  9. The server terminates gracefully if CTRL-C is pressed.

About

Lab course CS588 (Systems Lab)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages