Question: #include #include #include #include #include #include #include int main ( int argc, char * * argv ) { / * * * * * *

#include
#include
#include
#include
#include
#include
#include
int main(int argc, char **argv){
/*************************************************************
write code for the main process that will establish
the communication channel between cleint and server using
pipes
*************************************************************/
pid_t pid;
// TODO:
int fd[2];
if (pipe(fd)<0){
perror("Pipe creation failed
");
exit(EXIT_FAILURE);
}
pid = fork();
if(pid <0){
perror("Fork failed
");
return 1;
}
if(pid ==0){
// TODO:
close(fd[1]);
//call to server here: server(int readfd, int writefd);
server(fd[0], STDOUT_FILENO);
exit(0);
}
// TODO:
close(fd[0]);
//call to client here client(int readfd, int writefd);
client(STDIN_FILENO, fd[1]);
wait(NULL);
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!