EmbLogic's Blog

Successfully Implemented the inter-communication between 3 client , server and 3 processing-side by using pipes.

RCS file: header_server2.h,v
Working file: header_server2.h
head: 1.2
branch:
locks: strict
	root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
include 3 library <stdio.h> , <stdlib.h>
and <unistd.h>
create a function invoke_clients() to invoke the
3 clients simultaneously but actually it's a sequential process.
given the prototype for read_clients() and pass
the two argument one is int which is arrof pipe astruct display * for
reading the request from clients to server.
also include the defination of struct display in
header file. 3 datatype one for char opt and two int oper1 and
opern2.
now introduce processing_results() and pass two
arguments. new arr1* for creating new pipe and struct display *.
----------------------------
revision 1.2	locked by: root;
date: 2015/03/18 11:36:49;  author: root; 
state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2015/03/16 10:26:29;  author: root; 
state: Exp;
Initial revision
RCS file: new_server.c,v
Working file: new_server.c
head: 1.2
branch:
locks: strict
	root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
we create the *arr and provide the space for
read and write file descriptor means malloc * 6. 3 pipes we create
for 3 clients.
call the invoke_clients() and pass the address
of arr as argument.
declare **ptr and starting address store int ptr
and provide space with malloc.
store the 3 strings in 2D array.
create the pipes for 3 clients.
NOw, fork() is used to create duplicate copy or
new process .
in new process, we use execl() to replace new
process created by fork() with arguement we pass. And we also pass
two argument more read and write file discriptor but before passing
we converted it into string because execl() argument are in const
char *.
sprintf is used to convert int into char.
after this we read the request from client on
server.
then write the request to processing_results
pipes.
now, we created a processing_results() to
process the invoke_clients().
In processing_results() fumction we pass the
arr1 of 6 to create the 3 pipes.
declare the **p and provide space to store the
strings.
create the 3 pipes through for loop.
Now, fork() is used to create a new process. 
In child(new) process, we use execl() function
to replace the current process i.e new process. with arugment we used
in execl and also pass read and write file descriptor in char type
using sprintf.
----------------------------
revision 1.2	locked by: root;
date: 2015/03/18 11:36:54;  author: root; 
state: Exp;  lines: +18 -4
*** empty log message ***
----------------------------
revision 1.1
date: 2015/03/16 11:05:43;  author: root; 
state: Exp;
Initial revision


RCS file: client_sum.c,v
Working file: client_sum.c
head: 1.1
branch:
locks: strict
	root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
read the file disp through main argument.
convert it into integer by using atoi.
and then write it into pipe.
----------------------------
revision 1.1	locked by: root;
date: 2015/03/16 13:39:29;  author: root; 
state: Exp;
Initial revision
=============================================================================

RCS file: client_sub.c,v
Working file: client_sub.c
head: 1.1
branch:
locks: strict
	root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
we read the argument through main.
convert it into interger by using atoi before
using it into read and write function.
use struct display a object and using this 'a'
object we store the opt, opern1 and opern2.
and then write the result sub into pipe.
----------------------------
revision 1.1	locked by: root;
date: 2015/03/16 13:05:44;  author: root; 
state: Exp;
Initial revision
=============================================================================

RCS file: client_mul.c,v
Working file: client_mul.c
head: 1.1
branch:
locks: strict
	root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
same as above
----------------------------
revision 1.1	locked by: root;
date: 2015/03/16 13:33:06;  author: root; 
state: Exp;




RCS file: processing_sum.c,v
Working file: processing_sum.c
head: 1.2
branch:
locks: strict
	root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
read the rd and wd file descriptor from server
through argv argument.
convert argv[1] and argv[2] to rfd and wfd
integer.
read the content and print the content in
processing_sum file.
then write the result on the server pipe
----------------------------
revision 1.2	locked by: root;
date: 2015/03/18 11:36:58;  author: root; 
state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2015/03/06 08:21:16;  author: root; 
state: Exp;
Initial revision
=============================================================================

RCS file: processing_sub.c,v
Working file: processing_sub.c
head: 1.2
branch:
locks: strict
	root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
read write file discriptor is taken by main
argument
convert it into integer rfd and wfd.
by using atoi.
read the struct display through address and
print the opt, opern1, opern2.
and write the subtraction result into the
server-processing pipe.
----------------------------
revision 1.2	locked by: root;
date: 2015/03/18 11:36:59;  author: root; 
state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2015/03/17 15:02:50;  author: root; 
state: Exp;
Initial revision
=============================================================================

RCS file: processing_mul.c,v
Working file: processing_mul.c
head: 1.2
branch:
locks: strict
	root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
same as subtraction just changed the operator
and names and then write the result into pipe.
----------------------------
revision 1.2	locked by: root;
date: 2015/03/18 11:37:00;  author: root; 
state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2015/03/17 15:48:15;  author: root; 
state: Exp;
Initial revision
=============================================================================

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>