EmbLogic's Blog

Inter Process Communication using MESSAGE QUEUES.

IPC USING MESSAGE QUEUES

RCS file: header.h,v
Working file: header.h
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
included stdio.h, sys/msg.h, stdlib.h, sys/types.h, unistd.h, sys/ipc.h.
—————————-
revision 1.1
date: 2014/08/28 04:44:56;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: server.c,v
Working file: server.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
this is the server program.
it creates a message queue and waits to recieve data on it from a requesting client.
multiple fork calls are made according to the number of requesting client
each child of the server deals with respective client and sychronisation chived by the type field given in each message queue structure.
then the server sends a processing requst to the processing client.
once the processing client returns the result on a seperate message queue, the server puts the result back on the respective client message queue.
each client then picks up the message according to the type specified, which in turn is their own pid(process id).
—————————-
revision 1.1
date: 2014/08/28 04:54:05;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: client.c,v
Working file: client.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
This is the requesting client program.
It sends a request on the message queue created by the server.
and waits for the processed result.
picks up the message of its own type only.
here tpre is the pid of client.
—————————-
revision 1.1
date: 2014/08/28 05:05:52;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: process.c,v
Working file: process.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
This is the processing client.
it performs the calculations on request from the server.
and returns the answer in a message queue created by the server.
with a particular type attached to the mesage.
—————————-
revision 1.1
date: 2014/08/28 05:08:33;  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>