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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the process id for kernel process?

578


What is i-node numbers?

598


Explain the advantage of executing a process in background?

513


Please explain fork() system call?

559


Which ipc is faster?

567






Explain the initial process sequence while the system boots up?

550


What is the very first process created by kernel?

596


Explain linking across directories?

538


Max relax-able permission value with out giving write permission to others?

570


What is ipc port?

569


How to get or set an environment variable from a program?

545


What is ipc in unix?

561


What is unix ipc?

553


Explain what are the system calls used for process management?

514


What are two different models of ipc differentiate both?

580