EXERCISE - 1 Write a Program in C/ C++ for error detecting code using CRC-CCITT (16 bit)
Objective: To enable the receiver of a message transmitted through noisy channel to check whether the message has been corrupted. The aim of an error detection technique is to enable the receiver of a message transmitted through noisy channel to determine whether the message has been corrupted. To do this, the transmitter constructs a value called a checksum that is the function of message and appends it’s to message. The receiver can then use the same function to calculate the checksum of the received message and compare it with the appended checksum to see if the message was correctly received.
IMPLEMENTATION
Figure: Euclidean division algorithm The message is represented by a information polynomial i(x). i(x) is store as a bit pattern of k length in an integer array. The k information bits are represented by k-1 degree polynomial i(x) = i(k-1)x(k-1) + i(k-2)x(k-2) +……………………………..+i1x+i0 A polynomial code is specified by its generating polynomial g(x). If we assume that we are dealing with a code in which codewords have n bits of which k are information bits and n-k are check bits . The …show more content…
If not sure of machine IP address, keep the structure member s_addr to INADDR_ANY. Assign a port number between 3000 and 5000 to sin_port. 3) Listen for connections with the listen (sfd, …) system call 4) sfd = Accept a connection with the accept (sfd, …) system call. This call typically blocks until a client connects with the server. 5) Read the filename from the socket by n = read(sfd, buffer, sizeof(buffer)) 6) Open the file by fd = open(buffer) 7) Read the contents of the file by m = read(fd, buffer1, sizeof(buffer1)) 8) Write the file content to socket by write( sfd, buffer1, m) 9) Go to step 7 if m>0 10)