EmbLogic's Blog

server-client using threads in server(using aprox all IPC techniques

RCS file: ./server.c,v
Working file: ./server.c
head: 1.5
branch:
locks: strict
root: 1.5
access list:
symbolic names:
keyword substitution: kv
total revisions: 5; selected revisions: 5
description:
this is the server accepting data
—————————-
revision 1.5 locked by: root;
date: 2014/06/09 21:07:39; author: root; state: Exp; lines: +192 -95
in this code i am getting the data from the requesting client through the fifo then
giving switch call for the type of operator eg + and then in the case + ,i am calling thread in which i had
use fork and execl to dulplicate the processadd file to calculate the result of the operation and the data is shared to the processadd function to the server via a shared memory
after the data is processed the result is captured by the thread calling processadd and then sending to the respective r_clients through the message queue that are common to all the requesting clients
i had implemented the process level semaphore ,so that only 1 process should aquire the server at one time
the write of the requesting client is in the critical area of the semaphore and the messagequeue is present outside the critical region of the requesting client
WORKING FINE!!!!!!!!!!!!!!
—————————-
revision 1.4
date: 2014/05/30 16:28:40; author: root; state: Exp; lines: +128 -3
working succesfully with all the 4 cases if the r_clients enncounterred one by one
if encounterred grouply then error
sollution is attached a while loop in the switch but i am geeting error of segment default
to continued
—————————-
revision 1.3
date: 2014/05/30 05:10:01; author: root; state: Exp; lines: +57 -19
As we send th data from the server to processadd we are receiving the data variable res and tag through the
processadd to server via a message queues….
i got a problem here as i mentioned msgget and shmid together i am getting the problem in getting the
value of msg_id and shm_id and it it resolved as i put the msgget just after the shmctl remove the shared memory
WORKING SUCESSFULLY……the data result of add is received to the server
i am sending 10 and 20 from the request1 to server which on behaf of the case ‘+’ send dulplicate the proceess add and send the data through shared memory and the server receive the result through message queues.
—————————-
revision 1.2
date: 2014/05/28 15:21:46; author: root; state: Exp; lines: +35 -1
In this server ,we have requesting client 1 ,who sends the data in the form of packet structure
and fifo is connected to it with the server
we send the block of data to the server
block of data contain a,b,tag and oper
oper is checked by the server in the case statement and the data is stored in the structure contain a array of integer
and the we have to send it to the processing client ,processing client have nothing to done with oper
that is send by the requesting client
it it checked within the server
continueeeeee………………………….
—————————-
revision 1.1
date: 2014/05/28 15:05:07; author: root; state: Exp;
Initial revision
=============================================================================
*****************************************************************************************************************************************
RCS file: ./r_client1.c,v
Working file: ./r_client1.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the file where i am sending th data through the fifo to the server and receiving the data
through message queues and then printing the result
eg this client send 23+ through the fifo to the server
and geeting result 5
—————————-
revision 1.1 locked by: root;
date: 2014/06/09 21:06:51; author: root; state: Exp;
Initial revision
*************************************************************************************************************************************

RCS file: ./processadd.c,v
Working file: ./processadd.c
head: 1.4
branch:
locks: strict
root: 1.4
access list:
symbolic names:
keyword substitution: kv
total revisions: 4; selected revisions: 4
description:
this is processadd file
—————————-
revision 1.4 locked by: root;
date: 2014/06/09 21:15:02; author: root; state: Exp; lines: +1 -0
IN this file I am getting the data through the shared memory from the server and all the addition calculation
are done in this file
after the thread do fork and execl to the this file it will put the result in the message queue
which is acquired by their respective requesting clients .
WORKING FINE!!!!!!! for 4 req clients
—————————-
revision 1.3
date: 2014/05/30 16:30:22; author: root; state: Exp; lines: +2 -9
made all the 4 processing clients and are working properly
—————————-
revision 1.2
date: 2014/05/30 05:14:31; author: root; state: Exp; lines: +52 -0
In this the data variable a,b and tag is recive by the processadd via shared memory and after calculating the
add result it will put the resultin res and tag and then send the data back to the server via message queues.
—————————-
revision 1.1
date: 2014/05/28 15:07:04; 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>