EmbLogic's Blog

IPC

head 1.1;
access;
symbols;
locks
arjun:1.1; strict;
comment @ * @;

1.1
date 2014.03.21.15.02.57; author arjun; state Exp;
branches;
next ;

desc
@we are making a server which has 3 requesting client and 3 processing client
but right now it has 3 requesting client and 1processing client
we are using different pipe here for all type of client
all requesting client are working properly
bt processing client is not working properly
@

1.1
log
@Initial revision
@
text
@#include
#include
int main()
{
int pid,pfd[2],buf5[4],ret,z;
char a[4],b[4];
ret=pipe(pfd);
sprintf(a,”%d”,pfd[0]);
sprintf(b,”%d”,pfd[1]);
pid=fork();
if(pid>0)
{
printf(“i am parent\n”);
int i,retw,retr,pid1,add_ret,add_retr,add_pfd[2],buf1[3],buf2[3],buf[3],buf3[3];
char c[4],d[4],e[4],f[4],g[4],h[4],k[4],l[4],m[4],n[4];
retr=read(pfd[0],buf2,12);
for(i=0;i<3;i++)
printf("buf2[%d]=%d\n",i,buf2[i]);

add_ret=pipe(add_pfd);
sprintf(c,"%d",add_pfd[0]);
sprintf(d,"%d",add_pfd[1]);
pid1=fork();
if(pid1==0)
{
printf("i am child2\n");
execl("cl2","arjun",c,d,NULL);
}

add_retr=read(add_pfd[0],buf3,12);
for(i=0;i<3;i++)
printf("buf3[%d]=%d\n",i,buf3[i]);

int pid2,mul_pfd[2],mul_retr,mul_ret,buf4[3];
mul_ret=pipe(mul_pfd);
sprintf(e,"%d",mul_pfd[0]);
sprintf(f,"%d",mul_pfd[1]);

pid2=fork();
if(pid2==0)
{
printf("i am child3\n");
execl("cl3","arjun",e,f,NULL);
}

mul_retr=read(mul_pfd[0],buf4,12);
for(i=0;i<3;i++)
printf("buf4[%d]=%d\n",i,buf4[i]);

int pid3,padd_pfd[2],padd_retr,padd_ret,padd_retw,resadd;
padd_ret=pipe(padd_pfd);
sprintf(g,"%d",padd_pfd[0]);
sprintf(h,"%d",padd_pfd[1]);
pid3=fork();
if(pid3==0)
{
padd_retw=write(padd_pfd[1],buf2,12);
printf("i am pchild1\n");
execl("pcl1","arjun",g,h,NULL);
}
/*
printf("padd_retw=%d\n",padd_retw);
padd_retr=read(padd_pfd[0],&resadd,1);
printf("result is =%d",resadd);
*/
}
else
{
printf("i am child1\n");
execl("./cl1","arjun",a,b,NULL);
}

}

@

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>