EmbLogic's Blog

fifo server for three reqclient and three prosessing client program using three fifo

head    1.2;
access;
symbols;
locks
root:1.2; strict;
comment    @ * @;

1.2
date    2014.05.15.11.19.59;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.05.14.09.42.00;    author root;    state Exp;
branches;
next    ;

desc
@server iof fifo is.
@

1.2
log
@*** empty log message ***
@
text
@#include”header.h”
int main()
{

struct data data1;
int len,len1,ret,ret1,count,mul,fd,fd1,fd2,fd3,result;
ret=access(“raushan”,F_OK);
if(ret==-1)
{
ret=mkfifo(“raushan”,777);
}
fd=open(“raushan”,O_RDONLY);
if(fd<0)
{
perror(“\n open is failure”);
goto OUT;
}
len=sizeof(struct data);
count=read(fd,&data1,len);
printf(“\n bytes is %d %d %d %c”,count,data1.a,data1.b,data1.opr);
ret=access(“raushan1″,F_OK);
if(ret==-1)
{
ret=mkfifo(“raushan1″,777);

}
fd1=open(“raushan1″,O_WRONLY);
if(fd1<0)
{
perror(“\n open is failure”);
goto OUT;
}
len1=sizeof(struct data);
count=write(fd1,&data1,len1);
printf(“\n bytes is %d”,count);
fd1=open(“raushan1″,O_RDONLY);
len=sizeof(result);
count=read(fd1,&result,len);
printf(“\n result=%d”,result);
close(fd1);
fd=open(“raushan”,O_WRONLY);
len=sizeof(result);
count=write(fd,&result,len);
printf(“\n result=%d”,result);

ret=access(“raushan2″,F_OK);
if(ret==-1)
{
ret=mkfifo(“raushan2″,777);
}
fd2=open(“raushan2″,O_RDONLY);
if(fd2<0)
{
perror(“\n open is failure”);
goto OUT;
}
len=sizeof(struct data);
count=read(fd2,&data1,len);
printf(“\n bytes is %d %d %d %c”,count,data1.a,data1.b,data1.opr);
ret=access(“raushan3″,F_OK);
if(ret==-1)
{
ret=mkfifo(“raushan3″,777);

}
fd3=open(“raushan3″,O_WRONLY);
if(fd3<0)
{
perror(“\n open is failure”);
goto OUT;
}
len1=sizeof(struct data);
count=write(fd3,&data1,len1);
printf(“\n bytes is %d”,count);
fd3=open(“raushan3″,O_RDONLY);
len=sizeof(result);
count=read(fd3,&result,len);
printf(“\n result=%d”,result);
close(fd3);
fd2=open(“raushan2″,O_WRONLY);
len=sizeof(result);
count=write(fd2,&result,len);
printf(“written result is %d\n”,result);
return 0;
OUT:
return-1;

}
@

1.1
log
@Initial revision
@
text
@d6 1
a6 1
int len,len1,ret,count,fd,fd1,result;
d24 2
a25 1
ret=mkfifo(“raushan1″,777);
d40 1
d46 20
d67 19
@

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>