-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadder.c
More file actions
22 lines (21 loc) · 712 Bytes
/
adder.c
File metadata and controls
22 lines (21 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include"headers.h"
#include"request.h"
int main(int argc , char* argv[])
{
printf("processing client : begin\n");
int wfd=atoi(argv[1]);
printf("wfd : %d\n",wfd);
int rfd=atoi(argv[2]);
printf("rfd : %d\n",rfd);
result res;
request rq;
read(rfd,&rq,sizeof(rq));
res.pid=getpid();
res.opr1=rq.opr1;
res.opr2=rq.opr2;
res.result=res.opr1+res.opr2;
printf("rc1_pid :%d\noperation : %c\n",rq.pid,rq.opt);
printf("pc1_pid :%d\noperation : %c is done and result is :%d\n",rq.pid,rq.opt,res.result);
write(wfd,&res,sizeof(res));
printf("processing client : End\n");
}