Saturday, February 25, 2012

Write a program for Bit stuffing(Write a code for sender and receiver side both)

/* sender- Bit stuffing*/

#include
#include
#include
main()
{
int pid,i,fno,cnt,k,j;
char flag[]="01111110";
char frm[100],frm1[100]="",packet[100]="";
system("clear");
pid=open("pipe",O_WRONLY);
printf("Enter The Frame : ");
scanf("%d",&fno);
printf("\t\tEnter The Binary Data\n");
for(i=0;i/* sender- Bit stuffing*/

#include
#include
#include
main()
{
int pid,i,fno,cnt,k,j;
char flag[]="01111110";
char frm[100],frm1[100]="",packet[100]="";
system("clear");
pid=open("pipe",O_WRONLY);
printf("Enter The Frame : ");
scanf("%d",&fno);
printf("\t\tEnter The Binary Data\n");
for(i=0;i

Write a program for Byte stuffing framing method.(Code for sender and receiver side both)

/* Sender.c - Byte Stuffing*/

#include
#include
#include
main()
{
int fno,i,pid,k=0,j=0;
char str[100],packet[100]="",*ch,str1[100];
ch=(char *)malloc(sizeof(char));
ch[0]='$';
system("clear");
pid=open("pipe",O_WRONLY);
printf("Enter The No. Of Frame : ");
scanf("%d",&fno);
for(i=0;i/* receiver- Byte Stuffing*/

#include
#include
#include
main()
{
int pid,cnt=0,i=1;
char packet[100],ch='$';
system("clear");
mkfifo("pipe",0666);
pid=open("pipe",O_RDONLY);
read(pid,packet,100);
printf("%s\n\n",packet);
while(packet[cnt]!='\0')
{
if(packet[cnt]=='$'&& packet[cnt-1]!=='#')
{
cnt++;
}
else
{
printf("Frame %d : ",i);
i++;
while(packet[cnt]!='$')
{
if(packet[cnt]=='#')
{
cnt++;
}
printf("%c",packet[cnt]);
cnt++;
}
}
printf("\n");
}
close(pid);
unlink("pipe");
}

Write a program for character counter. (Sender and receiver both side)

/* Sender- Character count */

#include
#include
#include
#include
int main()
{
int pid,no,cnt=0;
char str[50],packet[100]="",*len;
system("clear");
len=(char *)malloc(sizeof(char));
pid=open("pipe",O_WRONLY);
printf("How Many Frames U Wnt To Enter : ");
scanf("%d",&no);
while(cnt/* Receiver - character count*/

#include
#include
#include
main()
{
int pid,cnt=0,len=0,i,k=1,j;
char packet[100],frame[100];
system("clear");
mkfifo("pipe",0666);
pid=open("pipe",O_RDONLY);
read(pid,packet,100);
printf("\nData Received Is : %s\n",packet);
while(packet[cnt]!=NULL)
{
len=packet[cnt]-48;
printf("\nFrame %d : ",k);
for(i=cnt+1,j=0;i

Wednesday, February 1, 2012

2 programs of FON.

1)Write a program to convert character to binary with ASCII.

#include
#include
void main()
{
int n1,c,i,rev[10],j=0;
char ch;
clrscr();

printf("Enter a Character:");
scanf("%c",&ch);
n1=(int)ch;
printf("The ASCII of %c is %d ",ch,n1);
c=n1;
while(c!=0)
{
i=c%2;
c/=2;
rev[j++]=i;
}
printf("Binary of %c is \n",ch);
for(i=j-1;i>=0;i--)
{
printf("%d",rev[i]);
}
getch();
}



2)Write a program to covert a decimal number into a binary number.

#include
#include
void main()
{
int n1,i;
int b1[10],c;
int j=0;
clrscr();
printf("Enter a number:");
scanf("%d",&n1);
c=n1;
while(c!=0)
{
i=c%2;
c/=2;
b1[j++]=i;
}
for(i=j-1;i>=0;i--)
{
printf("%d",b1[i]);
}
getch();
}

Something Useful

Dear Friends!

Below, I have mention some links which is useful for different purpose, I have also mention the purpose and what you can with use of that links.

1) www.khanacademy.org ----- Online video on any topic of any course. You can learn maths and all...

2)www.msdn.microsoft.com/en-us/library --- With use of this MSN link you can use all type of examples of ASP.net and etc...

3) www.freehindiradio.com/listen-red-fm-online ----- With use of this link, you can heard online radio but first you have to download frequency file of that station...

4) www.jquery.com ------- with use this link, you can find the video of j-query and you can learn also. There are also some examples of j-query. From that, you can use j-queey and download for your application to design...

$