EmbLogic's Blog

Single Client Server And Single Thread Communication Using FIFO With Use The Shell Script

RCS file: header.h,v
Working file: header.h
head: 1.15
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 15;    selected revisions: 15
description:
In file all include header files related this project.
—————————-
revision 1.15
date: 2016/02/25 06:18:43;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.14
date: 2016/02/25 06:15:12;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.13
date: 2016/02/24 09:13:23;  author: root;  state: Exp;  lines: +1 -0
In file include a semaphore.h header files .
—————————-
revision 1.12
date: 2016/02/24 08:44:38;  author: root;  state: Exp;  lines: +0 -1
In file remove a prototype second thread hendler function
—————————-
revision 1.11
date: 2016/02/23 16:38:46;  author: root;  state: Exp;  lines: +1 -0
In file decalre a prototypes another handler function this handler in server in handler function return type void.
—————————-
revision 1.10
date: 2016/02/23 11:41:03;  author: root;  state: Exp;  lines: +2 -1
In file declare a prototypes of signal handler is return type is chany void not a void .
void *.
—————————-
revision 1.9
date: 2016/02/23 11:39:06;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2016/02/23 10:30:18;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.7
date: 2016/02/23 10:28:18;  author: root;  state: Exp;  lines: +1 -0
In file now include a signal.h header file before declare a prototype signal handler functions.
—————————-
revision 1.6
date: 2016/02/23 10:18:53;  author: root;  state: Exp;  lines: +1 -0
In file include a new a header file signal.h
—————————-
revision 1.5
date: 2016/02/21 08:40:55;  author: root;  state: Exp;  lines: +1 -1
In file check how working
—————————-
revision 1.4
date: 2016/02/21 08:08:10;  author: root;  state: Exp;  lines: +1 -1
In file decalre a prototypes in will agrument pass in thread is type void *
—————————-
revision 1.3
date: 2016/02/21 07:49:17;  author: root;  state: Exp;  lines: +2 -0
In file decalre a prototypes of processing client thread .
—————————-
revision 1.2
date: 2016/02/20 05:54:00;  author: root;  state: Exp;  lines: +3 -0
In file include a header files.
—————————-
revision 1.1
date: 2016/02/20 05:33:07;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: request.h,v
Working file: request.h
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;     selected revisions: 2
description:
In file assgin a data in structure then open a fifo in write only mode then write the data .
—————————-
revision 1.2
date: 2016/02/23 10:19:14;  author: root;  state: Exp;  lines: +1 -0
In file in structure member decalre a pid variable in int type.
—————————-
revision 1.1
date: 2016/02/20 05:34:10;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: processing_client.c,v
Working file: processing_client.c
head: 1.30
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 30;    selected revisions: 30
description:
In file this is processing client thread this call from the server in file return and pasing argument is void *
then decalre a struct operations type a variable then open a fifo in read only mode then read the data all.
—————————-
revision 1.30
date: 2016/02/25 06:27:07;  author: root;  state: Exp;  lines: +2 -1
*** empty log message ***
—————————-
revision 1.18
date: 2016/02/24 11:00:55;  author: root;  state: Exp;  lines: +11 -1
In fioe        fd=open(“fifo”,O_RDONLY);

In file calling a sem_wait and sem_post and display this values.
—————————-
revision 1.17
date: 2016/02/24 09:59:46;  author: root;  state: Exp;  lines: +1 -2
*** empty log message ***
—————————-
revision 1.16
date: 2016/02/24 09:28:27;  author: root;  state: Exp;  lines: +2 -0
In file this thread starting call to the sem_wait beacuse now this thread for read for the working and any another
thread don’t interupted so then this thread complete the work then call to the sem_post beacuse this thread works are complted and out of critical section this thread .
—————————-
revision 1.15
date: 2016/02/24 09:17:08;  author: root;  state: Exp;  lines: +1 -1
In file removes a sum bugs.
—————————-
revision 1.14
date: 2016/02/24 09:16:27;  author: root;  state: Exp;  lines: +0 -1
*** empty log message ***
—————————-
revision 1.13
date: 2016/02/24 09:15:13;  author: root;  state: Exp;  lines: +2 -2
In file decalre a properly sem
sem_t type sem2 variable .
—————————-
revision 1.12
date: 2016/02/24 08:45:16;  author: root;  state: Exp;  lines: +5 -3
In file fretch a semaphore a variable void * type then this variable type cast in sem_init type and before signals methmethod are falied in thread because thread to main thread don’t send a signals always because thread id we do not can find
in main_thread so that reason is falied
—————————-
revision 1.11
date: 2016/02/23 16:44:20;  author: root;  state: Exp;  lines: +1 -0
decalre a pthread_t type id variable
—————————-
revision 1.10
date: 2016/02/23 16:39:52;  author: root;  state: Exp;  lines: +4 -1
In file frecth the value in thread id void * type then type cast of pthread_id data type then pthread_kill using the
SIGINT signal send the the main thread .
—————————-
revision 1.9
date: 2016/02/21 09:48:10;  author: root;  state: Exp;  lines: +1 -1
In file some corrections in code.
—————————-
revision 1.8
date: 2016/02/21 09:42:17;  author: root;  state: Exp;  lines: +7 -1
In file a get a data then solve the result means two variable add and in store a result variable then open a fifo
in write only mode then write the result.
—————————-
revision 1.7
date: 2016/02/21 09:18:11;  author: root;  state: Exp;  lines: +3 -3
In file remvoe the sleep in 3 second
—————————-
revision 1.6
date: 2016/02/21 08:41:18;  author: root;  state: Exp;  lines: +2 -2
In file pass a argument in a void * variable
—————————-
revision 1.5
date: 2016/02/21 08:29:01;  author: root;  state: Exp;  lines: +3 -0
*** empty log message ***
—————————-
revision 1.4
date: 2016/02/21 08:15:14;  author: root;  state: Exp;  lines: +1 -1
In file frecth a agrument is void * c
—————————-
revision 1.3
date: 2016/02/21 08:14:13;  author: root;  state: Exp;  lines: +2 -1
*** empty log message ***
—————————-
revision 1.2
date: 2016/02/21 08:08:58;  author: root;  state: Exp;  lines: +1 -1
In file fretch the argument thread_id varable void *
—————————-
revision 1.1
date: 2016/02/21 07:40:25;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: request_client.c,v
Working file: request_client.c
head: 1.13
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 13;    selected revisions: 13
description:
In file assgin a data in structure then open a fifo in write only mode then write the data .
—————————-
revision 1.13
date: 2016/02/23 11:42:19;  author: root;  state: Exp;  lines: +1 -1
In file signal handler change a return type only void not a void *.
—————————-
revision 1.12
date: 2016/02/23 11:39:07;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.11
date: 2016/02/23 10:23:23;  author: root;  state: Exp;  lines: +16 -4
In file make a signal handler names functions in file top and in which file calling to that functions and then add a
pause() and when SIGINT signal is genrate then calling to signal handler functions and sleep is removes in file .
—————————-
revision 1.10
date: 2016/02/21 11:34:30;  author: root;  state: Exp;  lines: +1 -0
In file check how working.
—————————-
revision 1.9
date: 2016/02/21 11:24:56;  author: root;  state: Exp;  lines: +2 -1
In file calling to sleep.
—————————-
revision 1.8
date: 2016/02/21 11:23:55;  author: root;  state: Exp;  lines: +2 -2
In file some removes a bugs .
—————————-
revision 1.7
date: 2016/02/21 11:23:10;  author: root;  state: Exp;  lines: +2 -2
In file decarle a result variable .
—————————-
revision 1.6
date: 2016/02/21 11:09:51;  author: root;  state: Exp;  lines: +17 -0
In file open a fifo in read only mode if fd is negative then call to open then read a result if read is failed then
report to read then display the result.
—————————-
revision 1.5
date: 2016/02/20 17:45:12;  author: root;  state: Exp;  lines: +1 -1
In file add a count varable how many bytes write a request_client in fifo then return a count any case count falied then then report it.
—————————-
revision 1.4
date: 2016/02/20 13:17:05;  author: root;  state: Exp;  lines: +1 -0
In file decalre a fd,count variables.
—————————-
revision 1.3
date: 2016/02/20 13:16:15;  author: root;  state: Exp;  lines: +3 -3
In file some removes a bugs
—————————-
revision 1.2
date: 2016/02/20 13:14:12;  author: root;  state: Exp;  lines: +1 -1
In file included request.h file corrections the speling mistake .
—————————-
revision 1.1
date: 2016/02/20 05:34:55;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: server.c,v
Working file: server.c
head: 1.43
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 43;    selected revisions: 43
description:
In file decalre a structure variable then check if user allow a permissions then create a fifo then read  a structure
then display a structure .
—————————-
revision 1.43
date: 2016/02/25 08:28:56;  author: root;  state: Exp;  lines: +1 -1
In file create a thread semaphore in semaphore a some eshu then resolve this .
—————————-
revision 1.42
date: 2016/02/25 06:25:03;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.41
date: 2016/02/25 06:22:47;  author: root;  state: Exp;  lines: +3 -3
*** empty log message ***
—————————-
revision 1.40
date: 2016/02/25 06:15:14;  author: root;  state: Exp;  lines: +0 -1
*** empty log message ***
—————————-
revision 1.39
date: 2016/02/25 06:13:16;  author: root;  state: Exp;  lines: +2 -5
*** empty log message ***
—————————-
revision 1.38
date: 2016/02/25 05:58:10;  author: root;  state: Exp;  lines: +0 -1
*** empty log message ***
revision 1.37
date: 2016/02/25 05:52:27;  author: root;  state: Exp;  lines: +25 -30
*** empty log message ***
—————————-
revision 1.36
date: 2016/02/24 12:36:19;  author: root;  state: Exp;  lines: +3 -4
*** empty log message ***
—————————-
revision 1.35
date: 2016/02/24 12:30:26;  author: root;  state: Exp;  lines: +44 -39
In file add a some if conditions.
—————————-
revision 1.34
date: 2016/02/24 11:36:48;  author: root;  state: Exp;  lines: +6 -1
*** empty log message ***
—————————-
revision 1.33
date: 2016/02/24 11:04:45;  author: root;  state: Exp;  lines: +10 -4
In file calling a sem_wait and sem_post in 6 times and display the 6 times.
.\
—————————-
revision 1.32
date: 2016/02/24 10:30:02;  author: root;  state: Exp;  lines: +3 -1
*** empty log message ***
—————————-
revision 1.31
date: 2016/02/24 10:08:40;  author: root;  state: Exp;  lines: +2 -5
*** empty log message ***
—————————-
revision 1.30
date: 2016/02/24 10:04:01;  author: root;  state: Exp;  lines: +9 -7
*** empty log message ***
—————————-
revision 1.29
date: 2016/02/24 09:59:50;  author: root;  state: Exp;  lines: +6 -3
*** empty log message ***
—————————-
revision 1.28
date: 2016/02/24 09:31:47;  author: root;  state: Exp;  lines: +3 -2
In file create thread before call to the sem_wait thread beacuse this thread is working of ready any other thread din’t interupted then write a data and then call to sem_post beasue this work is complted this main_thread out of critical
sections.
—————————-
revision 1.27
date: 2016/02/24 09:14:06;  author: root;  state: Exp;  lines: +1 -1
In file remove a some errors.
—————————-
revision 1.26
date: 2016/02/24 08:52:01;  author: root;  state: Exp;  lines: +15 -15
In file create a thread semhaphore a and then add a condtions if any cases falied a so return -1 or any negative value
and report the sem_init then add a sem_wait beause In critial section in thread then thread sem_post call then move
and critical section  in main thread
—————————-
revision 1.25
date: 2016/02/23 16:41:47;  author: root;  state: Exp;  lines: +9 -13
In file sleep(3) is system call removes and this replace a in pause and make a signal handler SIGINT signal and this
handler function calling the in server means main thread .
—————————-
revision 1.24
date: 2016/02/23 11:29:29;  author: root;  state: Exp;  lines: +2 -2
In file just checking
—————————-
revision 1.23
date: 2016/02/23 10:26:22;  author: root;  state: Exp;  lines: +29 -2
Im file send a signal send a SIGINT siganl in request client process .
—————————-
revision 1.22
date: 2016/02/21 11:34:48;  author: root;  state: Exp;  lines: +0 -1
In file check how working..
—————————-
revision 1.21
date: 2016/02/21 11:19:41;  author: root;  state: Exp;  lines: +21 -0
In file get a result then open a fifo in write only mode then if fd is no is negative then report the open and out
then write a result if any condition write is failed then report to write .
—————————-
revision 1.20
date: 2016/02/21 10:52:08;  author: root;  state: Exp;  lines: +2 -3
In file add twos sleep in 2-2 sec .
—————————-
revision 1.19
date: 2016/02/21 09:44:06;  author: root;  state: Exp;  lines: +8 -0
In file open a fifo then read only mode then read a result then display the result in server.
—————————-
revision 1.18
date: 2016/02/21 09:26:33;  author: root;  state: Exp;  lines: +1 -0
In file add a sleep in 2 second .
—————————-
revision 1.17
date: 2016/02/21 09:25:17;  author: root;  state: Exp;  lines: +0 -1
In file sleep is removed
—————————-
revision 1.16
date: 2016/02/21 09:18:30;  author: root;  state: Exp;  lines: +2 -2
In file add a sleep in 3 second .
—————————-
revision 1.15
date: 2016/02/21 08:41:43;  author: root;  state: Exp;  lines: +0 -1
/.
—————————-
revision 1.14
date: 2016/02/21 08:16:40;  author: root;  state: Exp;  lines: +1 -0
In file c is decalre variable.
—————————-
revision 1.13
date: 2016/02/21 08:15:39;  author: root;  state: Exp;  lines: +1 -1
In file pass a agrument in thread c
—————————-
revision 1.12
date: 2016/02/21 08:14:14;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.11
date: 2016/02/21 08:12:39;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2016/02/21 08:09:56;  author: root;  state: Exp;  lines: +1 -1
In file pass the argument in thread calling tym in server and before types to chnge a void * varbale .
—————————-
revision 1.9
date: 2016/02/21 08:04:33;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2016/02/21 08:02:35;  author: root;  state: Exp;  lines: +1 -1
In file put the NULL is some error then type cast is void *
—————————-
revision 1.7
date: 2016/02/21 08:01:09;  author: root;  state: Exp;  lines: +1 -1
In file thread calling in agrument is NULL.
—————————-
revision 1.6
date: 2016/02/21 07:54:08;  author: root;  state: Exp;  lines: +1 -1
In file correction the thread_create to chnge pthread_create and give the thread id is reffrence
—————————-
revision 1.5
date: 2016/02/21 07:49:55;  author: root;  state: Exp;  lines: +2 -2
In file declare a thread_id variable this data type of pthread_t
—————————-
revision 1.4
date: 2016/02/21 07:43:08;  author: root;  state: Exp;  lines: +14 -0
In file firstly create a thread then thread created then open a fifo in write only mode then write a the data in fifo.
—————————-
revision 1.3
date: 2016/02/20 17:58:58;  author: root;  state: Exp;  lines: +2 -2
date: 2016/02/20 17:58:58;  author: root;  state: Exp;  lines: +2 -2
In file server how many read a bytes sucessfully then return a no. of bytes store in count if read is failed then reporreport the read call .
—————————-
revision 1.2
date: 2016/02/20 05:54:11;  author: root;  state: Exp;  lines: +3 -1
In file declare a variables .
—————————-
revision 1.1
date: 2016/02/20 05:35:20;  author: root;  state: Exp;
Initial revision
=============================================================================
(-SHELL SCRIPT-
#! /bin/bash

delete()
{
rm -rf request_client
rm -rf *.o
rm -rf server
}

edit()
{
read -p “do you want a edit further (y or n)” answer

if [ 'y' = $answer ]
then

for file in $(ls *.h,v)
do
co -l $file
done

for file in $(ls *.c,v)
do
co -l $file
done
delete
exit 0
fi

}

execute()
{
read -p “do you want a compile a project” answer

if [ 'y' = $answer ]
then
if ( gcc -c  server.c -lpthread)
then
echo “compile is successfull”
else
echo “compile is failed”
edit
fi

if ( gcc -o request_client request_client.c )
then
echo “compile is sucessfull”
else
echo “compile is failed”
edit
fi

if ( gcc -c processing_client.c -lpthread )
then
echo “compile is sucessfull”
else
echo “compile is failed”
edit
fi
else
edit
fi

read -p “do you want a execute this project” answer

if [ 'y' = $answer ]
then
if (gcc -o server server.o processing_client.o -lpthread)
then
./server & ./request_client -lpthread
else
echo “executeable is failed”
edit
fi
else
edit
fi

}

logfile()
{
read -p “do you want a run a logfile” answer
if [ 'y' = $answer ]
then
chmod +x rlog.sh
./rlog.sh
fi
}

for file in $(ls *.h)
do
ci $file
done

for file in $(ls *.c)
do
ci $file
done

for file in $(ls *.h,v)
do
co $file
done

for file in $(ls *.c,v)
do
co $file
done
execute
logfile
edit

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>