EmbLogic's Blog

Completed MDC (Multiple data compression) in ‘c’

RCS file: RCS/header.h,v
Working file: header.h
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
All header file are included in this file
—————————-
revision 1.3
date: 2014/08/30 20:12:53;  author: root;  state: Exp;  lines: +5 -1
declare function
—————————-
revision 1.2
date: 2014/08/30 16:21:24;  author: root;  state: Exp;  lines: +2 -0
declare c_write function
—————————-
revision 1.1
date: 2014/08/28 18:01:10;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/main.c,v
Working file: main.c
head: 1.5
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 5;    selected revisions: 5
description:
main file
—————————-
revision 1.5
date: 2014/08/30 20:11:15;  author: root;  state: Exp;  lines: +6 -4
call decompress function and recover original string with the help of master array
—————————-
revision 1.4
date: 2014/08/30 14:27:27;  author: root;  state: Exp;  lines: +1 -1
get position in master array
—————————-
revision 1.3
date: 2014/08/30 12:48:25;  author: root;  state: Exp;  lines: +1 -0
create compress function
—————————-
revision 1.2
date: 2014/08/28 18:17:20;  author: root;  state: Exp;  lines: +2 -1
Got Code length sucessfully
—————————-
revision 1.1
date: 2014/08/28 17:59:22;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: RCS/function.c,v
Working file: function.c
head: 1.7
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 7;    selected revisions: 7
description:
Function file where all functions are defined
—————————-
revision 1.7
date: 2014/08/31 15:01:44;  author: root;  state: Exp;  lines: +3 -2
chnage the appearance of output
—————————-
revision 1.6
date: 2014/08/30 20:12:23;  author: root;  state: Exp;  lines: +47 -17
define function to decompress and recover the data
—————————-
revision 1.5
date: 2014/08/30 16:20:29;  author: root;  state: Exp;  lines: +35 -35
write compressed data into new file
—————————-
revision 1.4
date: 2014/08/30 14:27:53;  author: root;  state: Exp;  lines: +45 -9
get position in master array
—————————-
revision 1.3
date: 2014/08/30 12:48:58;  author: root;  state: Exp;  lines: +29 -16
rectify the master function as it was reallocating more memory priviously
—————————-
revision 1.2
date: 2014/08/28 18:18:51;  author: root;  state: Exp;  lines: +4 -1
Define Code length function
—————————-
revision 1.1
date: 2014/08/28 18:00:07;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 2: Multiple Data Compression and Encryption | Tagged , , | Leave a comment

Execl file replacement

Sir I have made two files in home/vivek/process directory named fork.c and add.c and I had made one child process and then call execl function by giving its path/file name then file name and then NULL argument. But it is not executing execl function and gave output as it is giving in child and parent. I have attached my code blelow

# include
# include
# include
#include
#include

int main()
{
pid_t pid;
int n,k;
pid=fork();
if(pid>0)
{
wait(&k);
WIFEXITED(k);
n=2;
printf(“\nmy argument is=%d\n”,WEXITSTATUS(k));
printf(“\ni am a parent and my id=%d\n”,getpid());
}
else
{
execl(“./add.c”,”add”,NULL);
n=4;
printf(“\ni am a child and my id=%d\n”,getpid());
}
return(n);
}

#include

int main()
{
int a,b,sum;
a=3;
b=6;
printf(“\nenter value of a=”);
scanf(“%d”,&a);
printf(“\nenter value of b=”);
scanf(“%d”,&b);
printf(“\nfinal result”);
sum=a+b;
printf(“\nsum=%d\n”,sum);
}

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

How to install grub on a floppy disk or a partition?

 

When you are working on an already installed linux distribution, the grub package will be bydefault installed on the system.

I will be showing you, the example’s of working with grub-legacy. Because any grub version number thats in the form 0.9x is grub-legacy now.(Please note the fact that grub-legacy is no longer under active developement.)

For this example, i will be working on a Red hat enterprise linux 5.

[root@localhost ~]# rpm -qa | grep grub
grub-0.97-13.5
[root@localhost ~]#

the above shown package, will also provide you with a command called grub-install.

[root@localhost ~]# whereis grub-install
grub-install: /sbin/grub-install /usr/share/man/man8/grub-install.8.gz
[root@localhost ~]# rpm -qf /sbin/grub-install
grub-0.97-13.5

As you can clearly see from the above command results that the grub-install command comes from the package grub-0.97-13.5

You can simply install grub, on your desired partition, as shown below, with the help of grub-install command.
[root@localhost ~]# grub-install /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
# this device map was generated by anaconda
(hd0)     /dev/sda
[root@localhost ~]#

In the above command, it will install grub in the MBR of the hard disk /dev/sda.
the above command result tells you an important fact to understand. It tells that, there is a device map file, and is asking us to check and confirm whether the file is correct or not.

noteDevice map file is used by grub to identify the OS device names in a precise way. GRUB uses this file to map the device names of BIOS to operating system device names.This was devised, because there was inconstancies with, Linux operating system’s device naming convention.

This file is configurable as per your requirement.

In the above example output of the /boot/grub/device.map tells that (hd0) in grub means /dev/sda in the operating system.

noteWhenever you install GRUB, on any of your partition, it gets installed and images are put under the directory “boot” in that partition.
If you want to install grub, under a directory other than the default “boot”, you need to specify the boot directory with a command line argument to grub-install command.

Imagine that you want to install grub, on one of your external hard disk, and is currently mounted under /mydisk. lets see how to do it.

[root@localhost ~]# grub-install --root-directory=/mydisk/grub/ /dev/sdb

 

Posted in Project 00: Linux System / Network Administration | Leave a comment

IPC using sockets AF_INET/ tcp

IPC Using SOCKETS AF_INET

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:
Server implementaton using TCP , AF_INET.
>> Calls used : socket(), bind(), listen(), accept().
>> sockaddr_in
—————————-
revision 1.1
date: 2014/08/28 05:26:46;  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:
AF_INET client program.
calls used: bind(), connect.
—————————-
revision 1.1
date: 2014/08/28 05:31:42;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

IPC using sockets AF_UNIX / TCP

IPC Using SOCKETS AF_UNIX

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:
Server implementaton using TCP , AF_UNIX.
>> Calls used : socket(), bind(), listen(), accept().
—————————-
revision 1.1
date: 2014/08/28 05:26:46;  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:
AF_UXIX client program.
calls used: bind(), connect.
—————————-
revision 1.1
date: 2014/08/28 05:31:42;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

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
=============================================================================

Posted in Uncategorized | Leave a comment

Server rcs ( TCP, AF_UNIX)

1
2 RCS file: server.c,v
3 Working file: server.c
4 head: 1.2
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 2; selected revisions: 2
11 description:
12 Implementation of server.
13 Protocol : TCP
14 Domain : AF_UNIX
15 —————————-
16 revision 1.2
17 date: 2014/08/25 05:19:58; author: root; state: Exp; lines: +10 -10
18 Server successfully implemented.
19 Server accepts requests and sends responses.
20 —————————-
21 revision 1.1
22 date: 2014/08/25 05:03:27; author: root; state: Exp;
23 Initial revision
24 =============================================================================
~
~
~
~
~
~
~
~
~
~
“logfile” 24L, 629C 1,0-1 All

Posted in Uncategorized | Leave a comment

Server rcs ( UDP, AF_UNIX)

1
2 RCS file: server.c,v
3 Working file: server.c
4 head: 1.2
5 branch:
6 locks: strict
7 root: 1.2
8 access list:
9 symbolic names:
10 keyword substitution: kv
11 total revisions: 2; selected revisions: 2
12 description:
13 implemented sockets for datagram under af_unix domain.
14 Works ok, but I have some queries.
15 Queries :
16 If more than one request come, then server’s sendto call returns bad file descriptor with each request it servers, but th e messages are exchanged properly
17 The server socket fd and the client socket fd are same, how come ?
18 —————————-
19 revision 1.2 locked by: root;
20 date: 2014/08/25 05:42:35; author: root; state: Exp; lines: +0 -6
21 Server successfully serves more than 1 client, but not simultaneoulsy, needs multithreading
22 —————————-
23 revision 1.1
24 date: 2014/08/22 20:27:03; author: root; state: Exp;
25 Initial revision
26 =============================================================================
~
~
~
~
~
~
~
1 line less; before #1 2 seconds ago 1,0-1 All

Posted in Uncategorized | Leave a comment

Server Implementation ( UDP , AF_INET)

1
2 RCS file: server.c,v
3 Working file: server.c
4 head: 1.2
5 branch:
6 locks: strict
7 root: 1.2
8 access list:
9 symbolic names:
10 keyword substitution: kv
11 total revisions: 2; selected revisions: 2
12 description:
13 Implementation fo server.
14 Protocol : UDP
15 Domain : AF_INET
16 —————————-
17 revision 1.2 locked by: root;
18 date: 2014/08/25 05:13:38; author: root; state: Exp; lines: +1 -0
19 Server is able to accpet client requests and send them response.
20 Server serves one client at a time.
21 —————————-
22 revision 1.1
23 date: 2014/08/25 05:07:54; author: root; state: Exp;
24 Initial revision
25 =============================================================================
~
~
~
~
~
~
~
~
~
“logfile” 25L, 678C 1,0-1 All

Posted in Uncategorized | Leave a comment

Socket Programming : ( Server Implementation for TCP under AF_INET domain )

1
2 RCS file: server.c,v
3 Working file: server.c
4 head: 1.2
5 branch:
6 locks: strict
7 access list:
8 symbolic names:
9 keyword substitution: kv
10 total revisions: 2; selected revisions: 2
11 description:
12 Implementation of server for stream socket ( TCP ) under AF_INET domain.
13 —————————-
14 revision 1.2
15 date: 2014/08/25 04:55:04; author: root; state: Exp; lines: +1 -0
16 Server successfully implemented.
17 —————————-
18 revision 1.1
19 date: 2014/08/25 04:53:24; author: root; state: Exp;
20 Initial revision
21 =============================================================================
~
~
~
~
~
~
~
~
~
~
~
~
~
“logfile” 21L, 595C 1,0-1 All

Posted in Uncategorized | Leave a comment

enter 5 number find largest and lowest number

RCS file: 4.2.c,v
Working file: 4.2.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
enter the 5 number and find largest and smallest number
—————————-
revision 1.1
date: 2014/08/24 06:33:38; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

Client Server communication -IPC ( using message queue )

header file ———————————-

 
RCS file: ./header.h,v
Working file: ./header.h
head: 1.5
branch:
locks: strict
root: 1.5
access list:
symbolic names:
keyword substitution: kv
total revisions: 5; selected revisions: 5
description:
—————————-
revision 1.5 locked by: root;
date: 2014/08/23 08:22:06; author: root; state: Exp; lines: +2 -0
gave pid to struct data member.
—————————-
revision 1.4
date: 2014/08/17 10:33:23; author: root; state: Exp; lines: +1 -0
add result to struct data members.
—————————-
revision 1.3
date: 2014/08/17 09:36:55; author: root; state: Exp; lines: +1 -1
implemented fork().
—————————-
revision 1.2
date: 2014/08/16 06:15:00; author: root; state: Exp; lines: +3 -3
declared header files for server.
declared structure for data & msg queue.
—————————-
revision 1.1
date: 2014/08/16 06:08:32; author: root; state: Exp;
Initial revision
=============================================================================

server ————————————-

 
RCS file: ./server.c,v
Working file: ./server.c
head: 1.24
branch:
locks: strict
root: 1.24
access list:
symbolic names:
keyword substitution: kv
total revisions: 24; selected revisions: 24
description:
—————————-
revision 1.24 locked by: root;
date: 2014/08/23 08:05:07; author: root; state: Exp; lines: +3 -3
………………
—————————-
revision 1.23
date: 2014/08/23 07:59:40; author: root; state: Exp; lines: +21 -9
made msgsnd afterr1.mtype
run processing clients in backg & while(1).
completed using 3 clients.
—————————-
revision 1.22
date: 2014/08/23 05:01:22; author: root; state: Exp; lines: +3 -3
completed
—————————-
revision 1.21
date: 2014/08/22 16:41:30; author: root; state: Exp; lines: +9 -4
gave pid member to struct data.
assigned to mtype 1 for +,2 for -,3 for *.
assigned vale of pid to mtype after received from processing client.
—————————-
revision 1.20
date: 2014/08/20 04:29:05; author: root; state: Exp; lines: +1 -1
implemented fork for creating three child.
—————————-
revision 1.19
date: 2014/08/20 04:21:38; author: root; state: Exp; lines: +1 -1
created two child.
—————————-
revision 1.18
date: 2014/08/20 04:05:42; author: root; state: Exp; lines: +3 -3
run processing clients in background.
—————————-
revision 1.17
date: 2014/08/17 13:17:36; author: root; state: Exp; lines: +40 -37
made whole process in while loop.
—————————-
revision 1.16
date: 2014/08/17 11:57:36; author: root; state: Exp; lines: +11 -0
implemented msgsnd() for sending struct msg to resultant client.
—————————-
revision 1.15
date: 2014/08/17 11:25:31; author: root; state: Exp; lines: +1 -1
. .
—————————-
revision 1.14
date: 2014/08/17 11:23:04; author: root; state: Exp; lines: +9 -7
implemented msgrcv() for receiving struct msg from msg_queue4.
—————————-
revision 1.13
date: 2014/08/17 11:15:37; author: root; state: Exp; lines: +9 -0
\made system call according to operator from client.
—————————-
revision 1.12
date: 2014/08/17 11:07:29; author: root; state: Exp; lines: +1 -1
declared id2.
—————————-
revision 1.11
date: 2014/08/17 11:06:55; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.10
date: 2014/08/17 11:05:20; author: root; state: Exp; lines: +25 -14
changed msgqueue id’s name.
wrote struct msg to msgqueue3.
—————————-
revision 1.9
date: 2014/08/17 10:13:46; author: root; state: Exp; lines: +1 -1
changed msgtyp in msgrcv() to 0.
—————————-
revision 1.8
date: 2014/08/17 09:43:09; author: root; state: Exp; lines: +3 -3
changed struct msg member name b to d.
—————————-
revision 1.7
date: 2014/08/17 09:41:06; author: root; state: Exp; lines: +6 -1
used system call msgrcv for receiving msg from msg_queue1.
—————————-
revision 1.6
date: 2014/08/17 09:38:01; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2014/08/17 09:37:18; author: root; state: Exp; lines: +13 -1
implemented fork().
—————————-
revision 1.4
date: 2014/08/16 07:00:17; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.3
date: 2014/08/16 06:54:17; author: root; state: Exp; lines: +7 -3
checked msg queue id for msg_queue1.
changed key for queue1,queue2,queue3,queue4.
printed msg_queue id for all queues.
—————————-
revision 1.2
date: 2014/08/16 06:24:53; author: root; state: Exp; lines: +19 -1
contain basic program for server
craeted four msg queues.
—————————-
revision 1.1
date: 2014/08/16 06:08:47; author: root; state: Exp;
Initial revision
=============================================================================

client  ————————————–

 
RCS file: ./client1.c,v
Working file: ./client1.c
head: 1.22
branch:
locks: strict
root: 1.22
access list:
symbolic names:
keyword substitution: kv
total revisions: 22; selected revisions: 22
description:
contain basic program for client1
created queue for transmitting msg from client1 to server.
—————————-
revision 1.22 locked by: root;
date: 2014/08/22 16:50:42; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.21
date: 2014/08/22 16:46:15; author: root; state: Exp; lines: +1 -1
assigned pid to member pid.
—————————-
revision 1.20
date: 2014/08/20 04:41:00; author: root; state: Exp; lines: +1 -1
improved result statement.
—————————-
revision 1.19
date: 2014/08/20 04:18:36; author: root; state: Exp; lines: +1 -1
..
—————————-
revision 1.18
date: 2014/08/18 04:55:16; author: root; state: Exp; lines: +2 -20
*** empty log message ***
—————————-
revision 1.17
date: 2014/08/18 04:39:10; author: root; state: Exp; lines: +4 -0
implemented system call msgctl() to remove created msgqueue’s.
—————————-
revision 1.16
date: 2014/08/18 04:37:36; author: root; state: Exp; lines: +2 -2
..
—————————-
revision 1.15
date: 2014/08/18 04:36:14; author: root; state: Exp; lines: +18 -4
implemented msgget() for msgq 3 & 4.
—————————-
revision 1.14
date: 2014/08/17 12:54:25; author: root; state: Exp; lines: +1 -1
changed msgflag in msgget() for msq1.
—————————-
revision 1.13
date: 2014/08/17 12:10:13; author: root; state: Exp; lines: +1 -1
changed arg 2 of msgsnd.
—————————-
revision 1.12
date: 2014/08/17 12:08:18; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.11
date: 2014/08/17 12:05:20; author: root; state: Exp; lines: +14 -2
modified msgrcv().
created msg_queue2.
—————————-
revision 1.10
date: 2014/08/17 12:01:52; author: root; state: Exp; lines: +3 -1
implemented msgrcv() for receiving result from server.
—————————-
revision 1.9
date: 2014/08/17 11:44:57; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2014/08/17 11:44:09; author: root; state: Exp; lines: +2 -2
..
—————————-
revision 1.7
date: 2014/08/17 11:42:25; author: root; state: Exp; lines: +5 -5
entered user data using command line.
—————————-
revision 1.6
date: 2014/08/17 09:24:43; author: root; state: Exp; lines: +7 -2
implemented system call msgsnd().]
—————————-
revision 1.5
date: 2014/08/16 07:23:57; author: root; state: Exp; lines: +1 -1
modified arg 2 of msgsnd.
—————————-
revision 1.4
date: 2014/08/16 07:21:03; author: root; state: Exp; lines: +7 -6
gave system call() msgsnd().
—————————-
revision 1.3
date: 2014/08/16 07:17:07; author: root; state: Exp; lines: +5 -0
gave user data in structure msg.
—————————-
revision 1.2
date: 2014/08/16 07:00:55; author: root; state: Exp; lines: +1 -0
printmsg_queue1 id.
—————————-
revision 1.1
date: 2014/08/16 06:49:46; author: root; state: Exp;
Initial revision
=============================================================================

addition ——————————————-

 
RCS file: ./add.c,v
Working file: ./add.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
implemented program code for addition.
—————————-
revision 1.1 locked by: root;
date: 2014/08/23 16:38:40; author: root; state: Exp;
Initial revision
=============================================================================

subtraction —————————————-

 
RCS file: ./subb.c,v
Working file: ./subb.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
implemented program code for subtraction.
—————————-
revision 1.1 locked by: root;
date: 2014/08/23 16:39:37; author: root; state: Exp;
Initial revision
=============================================================================

multipication —————————————–

 
RCS file: ./mul.c,v
Working file: ./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:
implemented program code for multipocation.
—————————-
revision 1.1 locked by: root;
date: 2014/08/23 16:40:23; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Parallel port modes
The IEEE 1284 Standard which has been published in 1994 defines five modes of data transfer for parallel port. They are,

1) Compatibility Mode
2) Nibble Mode
3) Byte Mode
4) EPP
5) ECP

Hardware
The pin outs of DB25 connector is shown in the picture below
Parallel Port

The lines in DB25 connector are divided in to three groups, they are

1) Data lines (data bus)
2) Control lines
3) Status lines

As the name refers , data is transferred over data lines , Control lines are used to control the peripheral and of course , the peripheral returns status signals back computer through Status lines. These lines are connected to Data, Control And Status registers internally . The details of parallel port signal lines are given below
Pin No (DB25) Signal name Direction Register – bit Inverted
1 nStrobe Out Control-0 Yes
2 Data0 In/Out Data-0 No
3 Data1 In/Out Data-1 No
4 Data2 In/Out Data-2 No
5 Data3 In/Out Data-3 No
6 Data4 In/Out Data-4 No
7 Data5 In/Out Data-5 No
8 Data6 In/Out Data-6 No
9 Data7 In/Out Data-7 No
10 nAck In Status-6 No
11 Busy In Status-7 Yes
12 Paper-Out In Status-5 No
13 Select In Status-4 No
14 Linefeed Out Control-1 Yes
15 nError In Status-3 No
16 nInitialize Out Control-2 No
17 nSelect-Printer OutControl-3 Yes
18-25 Ground - - -

Parallel port registers
As you know, the Data, Control and status lines are connected to there corresponding registers inside the computer. So by manipulating these registers in program , one can easily read or write to parallel port with programming languages like ‘C’ and BASIC.

The registers found in standard parallel port are ,

1) data register
2) Status register
3) Control register

As there names specifies, Data register is connected to Data lines, Control register is connected to control lines and Status register is connected to Status lines. (Here the word connection does not mean that there is some physical connection between data/control/status lines. The registers are virtually connected to the corresponding lines.). So what ever you write to these registers , will appear in corresponding lines as voltages, Of course, you can measure it with a multimeter. And What ever you give to Parallel port as voltages can be read from these registers(with some restrictions). For example , if we write ’1′ to Data register , the line Data0 will be driven to +5v. Just like this ,we can programmatically turn on and off any of the data lines and Control lines.

Posted in Uncategorized | Leave a comment

program to find sum of two numbers without using operator

RCS file: 1.c,v
Working file: 1.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
—————————-
revision 1.1 locked by: root;
date: 2014/08/19 12:34:16; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

A chat client ( to chat between two terminals) : Source code snippet

ret_msnd = msgsnd(ret_mget, &m_p, sizeof(struct content), 0);
89 if(strcmp(m_p.con.msg, “exit”) == 10)
90 {
91 printf(“Client 1 says bye\n”);
92 kill(pid, SIGINT); /* kill the child generated for reading the inbox, before parent goe s off */
93 exit(EXIT_SUCCESS);
94 }
95 if(ret_msnd == -1) /* msgsnd fails then kill the child , and the parent.*/
96 {
97 printf(“Failed to send message to write q\n”);
98 perror(“msgsnd”);
99 kill(pid, SIGINT);
100 exit(EXIT_FAILURE);
101 }

Posted in Uncategorized | Leave a comment