Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to write the program on full-duplex communication on
biderctional(e.g using two pipes)

Answers were Sorted based on User's Feedback



How to write the program on full-duplex communication on biderctional(e.g using two pipes)..

Answer / e.sridhar reddy

#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/ipc.h>
#include<sys/types.h>
int main()
{
int p1[2],p2[2],i;
char buf[5];
pipe(p1);
pipe(p2);
if(fork()==0)
{
printf("\n this is child(the input text is text)\n");
close(p1[0]);
close(p2[1]);
write(p1[1],"text",5);
read(p2[0],buf,5);
write(1,buf,5);
}
else
{
printf("\n this is parent(the output text is text)\n");
close(p2[0]);
close(p1[1]);
read(p1[0],buf,5)
for(i=0;i<4;i++)
buf[i]=to upper(buf[i]);
write(p2[1],buf,5)
}
}

Is This Answer Correct ?    27 Yes 11 No

How to write the program on full-duplex communication on biderctional(e.g using two pipes)..

Answer / karthik chowdary

#include<stdio.h>
main()
{
int p1[2],p2[2],a;
char *msg1="hai";
char *msg2="infosys";
char *buff[7];
a=fork();
pipe[p1];
pipe[p2];
if(a==0)
{
write(p1[1],msg1,7);
sleep(5);
read(p2[0],buff,7);
printf("%s",buff);
}
else
{
read(p1[0],buff,7);
printf("%s",buff);
write(p2[1],msg2,7);
}
}

Is This Answer Correct ?    16 Yes 17 No

Post New Answer

More Unix IPC Interview Questions

Explain the system calls used for process management?

0 Answers  


What is the very first process created by kernel?

0 Answers  


What is the condition required for dead lock in unix system?

0 Answers  


How to write the program on full-duplex communication on biderctional(e.g using two pipes)

2 Answers   Infosys,


How to know whether the message queue is empty or not.

1 Answers   Fibcom, HCL,


Explain what is the process id for kernel process?

0 Answers  


How do you execute one program from within another?

4 Answers  


What is daemon?

0 Answers  


What are two different models of ipc differentiate both?

0 Answers  


How to write the program on full-duplex communication on bidirectional(e.g using two pipes)?

0 Answers  


How to write the program on full-duplex communication on bidirectional?

0 Answers  


Which ipc is faster?

0 Answers  


Categories