GTU Network Programming Practical List


GTU Network Programming Practical List

1.   Write a program of VRC.
2.   Write a program of LRC.
3.   Write a program of CRC.
4.   Write a program of Check Sum.
5.   Write a program of one bit error detection and correction method.
          (Hamming Distance Method)
6.   Write a program for Byte stuffing. (For multiple frames)
7.   Write a program for Bit stuffing. (For multiple frames)
8.   Write program to implement data link layer protocol 1.
9.   Implement the protocol 2 for the following criteria.
          Frame size should be 100 to 300.
10.  Implement the protocol 3 for the following criteria.
       Frame size should be 100 to 300
       Framing techniques is byte stuffing.
       Send the Positive Ack for frame 1 to 4.
       Send the Negative Ack for frame 5.
       Send the frame 8 again because of time out.
11.  Implement the protocol 4  for the following criteria.
       Frame size should be 100 to 300.
       Framing techniques is bit stuffing.
       Send the Positive Ack for frame 1 to 4.
       Send the Negative Ack for frame 5.
       Send the frame 8 again because of time out.
12.  Implement the protocol 4 for the following criteria.
       Frame size should be 100 to 300
       Framing techniques is either byte stuffing or bit
       stuffing
       Send the Positive Ack for frame 1 to 4.
       Send the Negative Ack for frame 5.
       Send the frame 8 again because of time out.
13.  Implement the protocol 5 for the following criteria.
       Sliding window size is 5.
       Frame size is 100.
       Send the Positive Ack for frame 1 to 4.
       Send the Negative Ack for frame 5.
       Send the frame 8 again because of time out.
14.  Implement the protocol 6 for the following criteria.
       Sliding window size is 5.
       Frame size is 100.
       Send the Positive Ack for frame 1 to 4.
       Send the Negative Ack for frame 5.
       Send the frame 8 again because of time out.
15.  Write a program of shortest path.
16.  Write a program of Caesar Cipher.
17.  Write a program of Substitution Cipher. (S - Box)
18.  Write a program of Transposition Cipher. (P - BOX)
19.  Write a program of product Cipher.  (Combine S & P box)
20.  Write a program of RSA.
21.  Write a program of different Cipher Modes.

Write a program of Vertical Redundancy Check - VRC

Header File
========
void bitptrn(char ch)
{
        int chsize,bitset;
        for(chsize=(sizeof(char)*8)-1;chsize>=0;chsize--)
        {
                bitset=1<
                if(ch & bitset)
                {
                        printf("1");
                }
                else
                {
                        printf("0");
                }
        }
}

int noof1bit(char ch)
{
        int chsize,bitset,pbit;
        for(chsize=(sizeof(char)*8)-1,pbit=0;chsize>=0;chsize--)
        {
                bitset=1 << chsize;
                if(ch & bitset)
                {
                        pbit++;
                }
        }
        return(pbit);
}

Sender Program
============
int main()
{
        char ipch;
        int pbit,pout;
        FILE *infile;
        system("clear");
        infile=fopen("data.txt","r");
        pout=open("vrcpipe","O_WRONLY");
        printf("-----------------------------------\n");
        printf("Character   BitPattern   NewPattern");
        printf("\n-----------------------------------");
        while(feof(infile)==0)
        {
                ipch=getc(infile);
                if(feof(infile)==0)
                {
                        printf("\n    %c        ",ipch);
                        bitptrn(ipch);
                        pbit=noof1bit(ipch);
                        if((pbit%2)==1)
                                pbit=1<<7;
                        else
                                pbit=0;
                        ipch=ipch|pbit;
                        printf("     ");
                        bitptrn(ipch);
                        write(pout,&ipch,sizeof(char)); //write to pipe
                }//if over
        }//while over
        fclose(infile);
        printf("\n-----------------------------------");
        printf("\n\nPress enter key to exit...\n");
        system("read x");
        system("clear");
        return(0);
}

Receiver Program
============
int main()
{
        char ipch;
        int pbit,pin;
        const int bitset=127;
FILE *pin;
        system("clear");
        pin=fopen("vrcpipe","r");
        printf("-----------------------------------\n");
        printf("Character   BitPattern   OldPattern\n");
        printf("-----------------------------------");
while()
        {
                printf("\n    %c        ",ipch);
                bitptrn(ipch);
                pbit=noof1bit(ipch);
                if((pbit%2)==1)
                {
                        printf("\n\nError : Data received is incorrect");
                        exit(0);
                }
                ipch=ipch & bitset;
                printf("     ");
                bitptrn(ipch);
        }
        printf("\n-----------------------------------");
        printf("\n\nPress enter key to exit...\n");
        system("read x");
        system("clear");
        return(0);
}