We previously saw HP's big flagship Windows 8 products, the Envy Spectre XT Touchsmart ultrabook and the Envy X2, and now HP is ready to reveal a handful of its more traditional laptops. Like virtually every other Windows 8 laptop we've seen, these are due alongside Microsoft's new operating system in on October 26.



HP Envy m4

This mobile-minded addition to the growing Envy family has a brushed aluminum design, current-gen Intel Core i-series processors, and a 14-inch display. Options include a backlit keyboard and Intel's Wireless Display. Like all of the Envy laptops, and a growing number of Pavilion models, there's a Beats Audio system, which in this case includes two stereo speakers and a separate subwoofer. Keeping with the premium feel of the Envy line, the m4 starts at $899.


HP Pavilion Sleekbook 14 and 15


HP's Pavilion laptops are getting slimmer and faster, with mainstream parts and designs that are at least in the same ballpark as the more expensive Envy models (as we saw with the recent Pavilion m6). These new 14 and 15-inch models, in the brief look we had at them, offered few surprises for a budget/mainstream laptop line, but discrete Nvidia graphics are an option in the Intel-powered 15-inch version, while the 14-inch Sleekbook has an AMD CPU/GPU. The Sleekbook 14 will start at $499, and the Sleekbook 15 at $559.

WRITE A PROGRAM THAT DESCRIBES TCP/IP CLIENT SERVER COMMUNICATION IN DETAIL

AIM:
Program that illustrates tcp/ip client server communication in detail
PROGRAM:

TCP ECHO SERVER:main() function:

#include “unp.h”
main(int argc,char **argv)
{
int listenfd,connfd;
pid_t childfd;
socklen_t clilen;
struct sock_addr_in cliaddr,servadr;
listenfd=Socket(AF_INET,SOCL_STREAM,0);
bzero(&servadr,sizeof(servaddr);
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr,sin_port=htons(SERV_PORT);
bind(listenfd,(SA *) &servaddr, sizeof(servaddr));
listen(listenfd,LISTENQ);
for( ; ;)
{
clilen=sizeof(cliaddr);
connfd=accept9listenfd,(SA *) & cliaddr,&clilen);
if( (childpid=fork())==0)
close(listenfd);
str_echo(connfd);
exit(0);
}
close(connfd);
}
}



TCP ECHO SERVER:str_echo function:

#include “unp.h”
void str_echo(int sockfd)
{
ssize_t n;
char buf[MAXLINE];
again:
while( (n=read(sockfd,buf,MAXLINE) )>0)
written(sockfd,buf,n);
if(n<0 && errno==EINTR) goto again; else if (n>0)
err_sys(“str_echo:readerror”);
}

TCP ECHO CLIENT:main() function:

#include “unp.h”
int main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if(argc!=2)
err_quit(“usauge:tcpcli”);
sockfd=socket(AF_INET,SOCK_STREAM,0);
bzero(servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htons(SERV_PORT);
inet_pton(AF_INET,argv[1],&servaddr.sin_addr);
connect(sockfd,(SA *) &servaddr,sizeof(servaddr));
str_cli(stdin,sockfd);
exit(0);
}

TCP ECHO CLIENT:str_cli function:
#include “unp.h”
void str_cli(FILE *fp,int sockfd)
{
char sendline[MAXLINE],recvline[MAXLINE];
while(fgets(sendline,MAXLINE,fp)! = NULL)
{
if(readline(sockfd,recvline,MAXLINE)==0)
err_quit(“str_cli:server terminated prematurely”);

fputs(recvline,stdout);

}}


WRITE A PROGRAM THAT DESCRIBES UDP CLIENT SERVER COMMUNICATION IN DETAIL

AIM:
Program that illustrates udp client server communication in detail
PROGRAM:

UDP ECHO SERVER:main() function:

#include “unp.h”
main(int argc,char **argv)
{
int sockfd;
pid_t childfd;
socklen_t clilen;
struct sock_addr_in cliaddr,servaddr;
sockfd=Socket(AF_INET,SOCK_DGRAM,0);
bzero(&servadr,sizeof(servaddr);
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr,sin_port=htons(SERV_PORT);
bind(listenfd,(SA *) &servaddr, sizeof(servaddr));
dg_echo(sockfd,(SA *) &cliaddre,sizeof(cliaddr));
}



UDP ECHO SERVER:dg_echo function:


#include “unp.h”
void dg(int sockfd, SA *pcliaddr, sockeln_t clilen)
{
int n;
socklen_t len;
char mesg[MAXLINE];
for( ; ; )
{
len=clilen;
n=recvfrom(sockfd,mesg,MAXLINE,0,pcliaddr,&len);
sendto(sockfd,mesg,n,0,pcliaddr,len);
}
}




UDP ECHO CLIENT:main() function:

#include “unp.h”
int main(int argc, char **argv)
{
int sockfd;
struct sockaddr_in servaddr;
if(argc!=2)
err_quit(“usauge:UDPcli”);

bzero(servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htons(SERV_PORT);
inet_pton(AF_INET,argv[1],&servaddr.sin_addr);
sockfd=socket(AF_INET,SOCK_DGRAM,0);

dg_cli(stdin,sockfd,(SA *) &servaddr,sizeof(servaddr));
exit(0);
}

UDP ECHO CLIENT:dg_cli function:

#include “unp.h”
void dg_cli(FILE *fp,int sockfd,const SA *pervaddr,socklen_t servlen)
{
Int n;
char sendline[MAXLINE],recvline[MAXLINE];
while(fgets(sendline,MAXLINE,fp)! = NULL)
{
sendto(sockfd,sendline,strlen(sendline),0,servaddr,servlen);
n=recvfrom(sockfd,recvline,MAXLINE,0,NULL,NULL);
recvline[n]=0;
fputs(recvline,stdout);

}
}


WRITE A PROGRAM TO PERFORM MESSAGE QUEUES
AIM:
Program to perform message queues
DESCRIPTION:
MsqQ is the faster IPC
msgQ also provides synchronization for communication between two processes..
It is faster because the data transfer is done through DMA(direct mem access)..

Type is the second filtering mechanism for IPC here.(adv compared to fifo&pipe)

PROGRAM:
Save: msgrcv.c
#include
#include
#include
main(int argc,char *argv[])
{
int key,id;
struct msgbuf{
long type;
char data[128];
}rcv;
rcv.type=atoi(argv[2]);//type for messageQueue
key=atoi(argv[1]);//key is used to connect to the queue
id=msgget(key,IPC_CREAT|0664);
//msgget gets the id of the msgQ associated with the key....if msgQ doesn't exist with that key,then it creates the msgQ with that key and returns the id.
if(id<0) { perror(""); return; } printf("msgid==%d",id); //msgrcv is the funtion to receive a msg from msgQueue if(msgrcv(id,&rcv,128,rcv.type,0)) { printf("message is : %s",rcv.data); } } //Program for Msgsnd save: msgsnd.c #include
#include
#include
#include
main(int argc,char *argv[])
{
struct msgbuf {
long type;
char data[128];
}snd;
int key,id;
if(argc!=3)
{
printf("Invalid no of arguments\n");
return;
}
key=atoi(argv[1]);
snd.type=atoi(argv[2]);
printf("Enter the msq:");
scanf("%[^\n]",snd.data);
id=msgget(key,IPC_CREAT|0664);
if(msgsnd(id,&snd,strlen(snd.data),0))
printf("Successfully sent.....\n");
else
{
perror("");
return;
}
}

OUTPUT:
$ cc msgsnd.c
$ ./a.out
Enter msg: hai
Successfully sent
$ cc msgq.c
$ ./a.out
Msgid==0
Message is:hai
WRITE A PROGRAM THAT ILLUSTRATES FILE LOCKING USING SEMAPHORES

AIM :
C program that illustrate file locking using semaphores

PROGRAM:

#include
#include
#include
#include
#include
#include
int main(void)
{
key_t key;
int semid;
union semun arg;
if((key==ftok("sem demo.c","j"))== -1)
{
perror("ftok");
exit(1);
}
if(semid=semget(key,1,0666|IPC_CREAT))== -1)
{
perror("semget"):
exit(1);
}
arg.val=1;
if(semctl(semid,0,SETVAL,arg)== -1)
{
perror("smctl");
exit(1);
}
return 0;
}


OUTPUT:
semget
smctl

PROGRAM THAT ILLUSTRATES PIPE
AIM:
Program for Pipe
DESCRIPTION:
Pipe is a IPC.Pipe provides communication as well as synchronization between two "related " processes

PROGRAM:

#include
#include
#include
main()
{
int filedes[2]; //argument for pipe fn....filedes[0] is for
reading...filedes[1] for writing to the pipe
char wrbuff[128],rdbuff[128]="hello this is child";
pid_t pid;
int i=pipe(filedes);//creates pipe
if (i==0)
{
printf("Pipe is Successfully created\n");
}
else
{
perror("");
}
pid=fork();
if(pid==0)
{
//child process
printf("In child process====%d\n",getppid());
read(filedes[0],rdbuff,128);//reading from read-end of pipe
printf("Msg from parent is %s\n",rdbuff);

}
else
{
//parent process
printf("In parent process\npid=====%d\n",getpid());
printf("Enter msg:");
scanf(" %[^\n]",wrbuff);
write(filedes[1],wrbuff,128);//writing to the write-end of pipe
}
}

OUTPUT:

$ cc pip.c
$ ./a.out

In child process==3564
In parent process== 3564
Enter msg:
hello
Message from parent is hello





























WRITE A PROGRAM ON ILLUSTRATING SHARED MEMORY
AIM:
Program on illustrating Shared memory
DESRIPTION:
It is a PURE IPC....i.e, no synchronization is established between the two process..
It is the fastest IPC
Uses direct memory block
No extra fns for writing or reading from shared mem segment

PROGRAM:
// PROGRAM FOR SMS RCV save: smsrcv.c
#include
#include
#include
main()
{
int id;
void *ptr;
id=shmget(22,128,IPC_CREAT|0664);//shmget allocates the shared memory segment and returns the id associated with key......
ptr=shmat(id,0,0);//shmat attaches the shared memory segment identified by the id for shared memory operation and returns the address of shared memory segment.
if(ptr)
{
printf("attached successfully\n");
}
else
{
perror("");
return;
}
printf("received :%s",(char*)ptr);//receiving the data from the shared mem segmet
shmdt(ptr);
}



Save: smssnd.c

#include
#include
#include
main()
{
int id;
void *ptr;
id=shmget(22,128,IPC_CREAT|0664);
if(ptr=shmat(id,0,0))
{
printf("Successfully attached\n");
}
else
{
perror("");
return;
}
printf("Enter the msg :");
scanf("%[^\n]",ptr);
}
OUTPUT:
$ cc smssnd.c
$ ./a.out
Successfully attached
Enter the message:hai
$ cc smsrcv.c
$ ./a.out
Attached successfully
Received:hai













WRITE A C PROGRAM THAT DISPLAYS THE REAL TIME OF A DAY EVERY 60 SECONDS

AIM :
C program that displays the real time of a day every 60 seconds

PROGRAM :

#include
#include
#include
int main(void)
{
struct timeval t;
int h,m,s,sl;
gettimeofday(&t);
s1=t.ti_sec;
while(!kbhit())
{
gettime(&t);
h=t.ti_sec;
if(s1==s)
{
printf("%d :%d :%d ,h,m,s);
delay(5000);
}
}
}


OUTPUT:
13:29:12











WRITE A PROGRAM TO PERFORMS FIFO

AIM:
Program that performs FIFO
DESCRIPTION:

Fifo is also called as named pipe
Fifo is used for IPC with synchronization
Fifo can also be used for IPC between non related processes

PROGRAM:

Save: fif.c
#include
#include
#include
#include
main()
{
pid_t p;
char buf[128],rdbuf[128];
int i=mkfifo("textf1",S_IRWXU);//mkfifo to create a fifo
if(i==0)
{
printf("Fifo is created\n");
}
else
perror("");
p=fork();//to create a child
if(p==0)
{
//child
int fd=open("textf1",O_RDWR);//opening the special file fifo
read(fd,rdbuf,128);//reading the data into rdbuf through file
descriptor fd
printf("Msg from parent is :%s",rdbuf);
}
else
{
//parent
int fd2=open("govin",O_RDWR);
printf("Enter a msg::\n");
scanf("%[^\n]",buf);
write(fd2,buf,128);//writing the data in the buf to fifo
through file descriptor fd2
}
}

Save: f1.c
#include
#include
#include
#include
main()
{
int fd;
char str[123]="this is process one1111111111111";
mkfifo("textf12",S_IRWXU);
fd=open("textf12",O_RDWR);
write(fd,str,123);
}

Save:f2.c
/****Program2****/
#include
#include
#include
#include
main()
{
int fd;
char str[128];
mkfifo("textf12",S_IRWXU);
fd=open("textf12",O_RDWR);
read(fd,str,123);
printf("str::::%s",str);
}
OUTPUT:
$ cc fif.c
$ ./a.out
Fifo is created
Enter a msg:: hai
$ cc f1.c
$ cc f2.c
$ ./a.out
str::::this is process one11111111111
WRITE A PROGRAM THAT TAKES THE CONTENTS OF A TEXT FILE & COPIES THEM INTO ANOTHER TEXT FILE CHARACTER BY CHARACTER

AIM :
Program that takes the contents of a text file & copies them into another text file character by character

PROGRAM :

#include
int main()
{
FILE *fp;
FILE *fp1;
char c;
fp=fopen("abc.txt","r");
fp1=fopen("bc.txt","w");
while(1)
{
c=fgetc(fp);
if(c==EOF)
break;
else
fputc(c,fp1);
}
fclose(fp);
fclose(fp1);
}




OUTPUT:

$ vi abc.txt
hai
$ vi c.txt
$ cc copy.c
$ . /a.out
$ vi bc.txt
Yoga health benefits are vast as they help to stretch, tone and strengthen every part of the body; they also massage internal organs and allow the practitioner to find a healthy balance in life. Yoga benefits are evident. One simple recommendation: don’t overload. Yoga health benefits are countless as you will be stress free, smooth movements of your joints, reduces your joint pain and improvement of immunity system helps to fight with other diseases.

Stress is the number one suspect affecting all parts of our physical, endocrinal and emotional system. And with the help of yoga this things can be corrected.

At the physical level, yoga and its cleansing practices have proven to be extremely effective for various disorders.

yoga health benefitsListed below are just some of the yoga health benefits that you can get.

Yoga Benefit 1: Yoga is known to increase flexibility; yoga has postures that trigger the different joints of the body. Including those joints that are not acted upon with regular exercises routines.

Yoga Benefit 2: Yoga also increases the lubrication of joints, ligament and tendons. The well-researched yoga positions exercise the different tendons and ligaments of the body.

It has also been found that the body which may have started doing yoga being a rigid one may experience a quite remarkable flexibility in the end on those parts of the body which have not been consciously worked upon.

Yoga Benefit 3: yoga also massages all organs of the body. Yoga is perhaps the only exercise that can work on through your internal organs in a thorough manner, including those that hardly get externally stimulated during our entire lifetime.

Yoga Benefit 4: Yoga acts in a wholesome manner on the various body parts. This stimulation and massage of the organs in turn benefits us by keeping away disease and providing a forewarning at the first possible instance of a likely onset of
disease or disorder.

One of the far-reaching yoga health benefits is the uncanny sense of awareness that it develops in the practitioner of an impending health disorder or infection. This in turn enables the person to take pre-emptive corrective action

Yoga Benefit 5: Yoga offers a complete detoxification of the body. It gently stretches the muscles and joints as we;; as massaging the various organs, yoga ensures the optimum blood supply to various parts of the body.

This helps in the flushing out of toxins from every nook and cranny of your body as well as providing nourishment up to the last point. This leads to benefits such as delayed ageing, energy and a remarkable zest for life.

Yoga Benefit 6: Yoga is also an excellent way to tone your muscles. Muscles which have been flaccid and weak are stimulated repeatedly to shed excess fats and flaccidity.

But these enormous physical benefits are just a “side effect” of this powerful practice. What yoga does is harmonize the mind with the body and these results in real quantum benefits. For the best yoga positions and yoga exercises check out the secrets of yoga.

It is now an open secret that the will of the mind has enabled people to achieve extraordinary physical feats, which proves beyond doubt the mind and body connection.

Regular practitioners of yoga report an elevated sense of well being with marked mood improvement and a lessening of anxiety and depression. Regularly releasing this negativity leads to a reduction of depression in many people. Regular practice of yoga does that for you and thus, provides healthier organs, skin and brain.

Additionally, yoga’s ability to lower levels of cortisol helps keep calcium in the bones, thereby reducing chances of osteoporosis. Finally, yoga can make you more aware of your own body, more conscious of its strengths, weaknesses and needs.

// Fork

main()
{
int childpid;
if(childpid=fork()<0) exit(0); if(childpid>0)
{
printf("***Parent Process***\n");
printf("My pid=%d\nMy parent pid=%d\n",getpid(),getppid());
while(wait((int *)0)!=childpid);
}
else
{
printf("***Child process***\n");
printf("My pid=%d\nMy parentpid=%d\n",getpid(),getppid());
}
}


Output:

[mtechcs@cse11 007]$ ./a.out
***Child process***
My pid=6543
My parentpid=6542
***Parent process***
My pid=6542
My parentpid=6507
[mtechcs@cse11 007]$













//Pipes (pipes.c)

#define MAX 100
main()
{
int childpid,pipe1[2],pipe2[2],nread,nwrite;
char buff[MAX];
//pipe(pipe1);
//pipe(pipe2);
if((pipe(pipe1)<0||pipe(pipe2)<0)) { printf("ERROR: pipes not created"); exit(0); } if((childpid=fork())<0) { printf("error in process\n"); exit(0); } if(childpid>0)
{
printf("writing to the server\n");
close(pipe1[0]);
close(pipe2[1]);
nread=read(0,buff,MAX);
nwrite=write(pipe1[1],buff,nread);
if(nread!=nwrite)
printf("Write Error");
nread=read(pipe2[0],buff,MAX);
nwrite=write(1,buff,nread);
if(nread!=nwrite)
printf("Standard Output Error\n");
while(wait((int*)0)!=childpid);
close(pipe1[1]);
close(pipe2[0]);
exit(0);
}
else
{
close(pipe1[1]);
close(pipe2[0]);
nread=read(pipe1[0],buff,MAX);
strcat(buff,"from the server");
nread=strlen(buff);
nwrite=write(pipe2[1],buff,nread);
close(pipe1[0]);
close(pipe2[1]);
exit(0);
}
}

Output:

[mtechcs@cse11 007]$ cc pipes.c
[mtechcs@cse11 007]$ ./a.out
Writing to the server
Pipes created
Pipes created
from the server[mtechcs@cse11 007]$





























//Related FIFO (relfifo.c)

#include
#define MAX 100
#define FIFO1 "./FIFO1"
#define FIFO2 "./FIFO2"
#define PERMS 0666

main()
{
int childpid,readfd,writefd,nread,nwrite;
char buff[MAX];

if(mknod(FIFO1,S_IFIFO|PERMS,0)<0) printf("FIFO1 created\n"); if(mknod(FIFO2,S_IFIFO|PERMS,0)<0) printf("FIFO2 created\n"); else unlink(FIFO1); if((childpid=fork())<0) { printf("error in process\n"); exit(0); } if(childpid>0)
{
printf("***Parent Process***\nWriting to the server\n");
writefd=open(FIFO1,1);
readfd=open(FIFO2,0);
nread=read(0,buff,MAX);
nwrite=write(writefd,buff,nread);
if(nread!=nwrite)
printf("Write Error!\n");
nread=read(readfd,buff,MAX);
nwrite=write(1,buff,nread);
if(nread!=nwrite)
printf("Standard Output Error\n");
while(wait((int*)0)!=childpid);
close(readfd);
close(writefd);
unlink(FIFO1);
unlink(FIFO2);
exit(0);
}
else
{
readfd=open(FIFO1,0);
writefd=open(FIFO2,1);
nread=read(readfd,buff,MAX);
strcat(buff,"from the server");
nread=strlen(buff);
nwrite=write(writefd,buff,nread);
close(readfd);
close(writefd);
exit(0);
}
}

Output:

[mtechcs@cse11 007]$ cc relfifo.c
[mtechcs@cse11 007]$ ./a.out
FIFO1 created
FIFO2 created
***Parent process***
Writing to the server
M.Tech IT
M.Tech IT
from the server Write error!
[mtechcs@cse11 007]$


















// Unrelated FIFO

//Server (servfifo.c)

#include"myfifo.h"
main()
{
int childpid,readfd,writefd,nread,nwrite;
char buff[MAX];
if(mknod(FIFO1,S_IFIFO|PERMS,0)<0) printf("FIFO1 created\n"); if(mknod(FIFO2,S_IFIFO|PERMS,0)<0) printf("FIFO2 created\n"); else unlink(FIFO1); if((childpid=fork())<0) { printf("error in process\n"); exit(0); } if(childpid>0)
{
printf("***Parent Process***\nWriting to the server\n");
readfd=open(FIFO1,1);
writefd=open(FIFO2,0);
nread=read(readfd,buff,MAX);
nwrite=write(writefd,buff,nread);
if(nread!=nwrite)
printf("Write Error\n");
nread=read(readfd,buff,MAX);
nwrite=write(1,buff,nread);
if(nread!=nwrite)
printf("Standard Output Error\n");
while(wait((int*)0)!=childpid);
exit(0);
}
}







//Client (clififo.c)

#include"myfifo.h"



jcjmain()
{
int childpid,readfd,writefd,nread,nwrite;
char buff[MAX];

printf("***Child Process***\n");
writefd=open(FIFO1,1);
readfd=open(FIFO2,0);
nread=read(0,buff,MAX);
strcat(buff,"from the server");
nread=strlen(buff);
nwrite=write(writefd,buff,nread);
close(readfd);
close(writefd);
unlink(FIFO1);
unlink(FIFO2);
exit(0);
}






















//Header file (myfifo.h)

#include
#define MAX 100
#define PERMS 0666
#define FIFO1 "/user/tmp/FIFO1"
#define FIFO2 "/user/tmp/FIFO2"


Output:

[mtechcs@cse11 007]$cc –o client clififo.c
[mtechcs@cse11 007]$cc –o server servfifo.c
[mtechcs@cse11 007]$./server&
[mtechcs@cse11 007]$./client
FIFO1 created
FIFO2 created
***Parent Process***
Writing to the server
hello
***Client Process***
hello
from the server





















//Message Queues

//Header File (mymsg.h)

#include
#include
#include
#include
#define PERMS 0666
#define MHDRSIZE sizeof(mesg)-MAXDATASIZE;
#define MAXDATASIZE 1024
#define MKEY1 1234L
#define MKEY2 2345L

typedef struct msgbuff{
int mesg_len;
long int mesg_type;
char mesg_data[MAXDATASIZE];
}mesg;

//Client (climsg.c)

#include"mymsg.h"
main()
{
int readqid,writeqid;
writeqid=msgget(MKEY1,0);
readqid=msgget(MKEY2,0);
client(readqid,writeqid);
msgctl(readqid,IPC_RMID,0);
msgctl(writeqid,IPC_RMID,0);
exit(0);
}
client(readqid,writeqid)
{
int len,nread;
mesg message;
nread=read(0,message.mesg_data,MAXDATASIZE);
message.mesg_type=1;
msgsnd(writeqid,(struct type *)message.msgbuff,nread,0);
msgrcv(readqid,message.mesg_data,message.mesg_len,0,0);
write(1,message.mesg_data,MAXDATASIZE);
}

//Server (servmsg.c)

#include"mymsg.h"
mesg message;
int nread;
main()
{
int readqid,writeqid;
readqid=msgget(MKEY1,PERMS|IPC_CREAT);
writeqid=msgget(MKEY2,PERMS|IPC_CREAT);
server(readqid,writeqid);
exit(0);
}
server(readqid,writeqid)
{
msgrcv(readqid,message.mesg_data,MAXDATASIZE,message.mesg_type,0);
msgsnd(writeqid,(struct type *)msgbuff,nread,0);
}


























//Shared memory

//Header File (myshm.h)

#include
#include
#include
#define PERMS 0666
#define MHDRSIZE sizeof(mesg)-MAXDATASIZE;
#define MAXDATASIZE 100
#define SHMKEY 1234L

typedef struct msgbuff{
int mesg_len;
long int mesg_type;
char mesg_data[MAXDATASIZE];
}mesg;

//Server (servshm.c)

#include"myshm.h"
mesg *msgptr;
main()
{
int shmid;
shmid=shmget(SHMKEY,sizeof(mesg),PERMS|IPC_CREAT);
msgptr=(mesg *)shmat(shmid,0,0);
strcat(msgptr->mesg_data,"FROM SERVER");
mshptr->mesg_type=2L;
msgptr->mesg_len=strlen(msgptr->mesg_data);
}













//Client (clishm.c)

#include"myshm.h"
Mesg *msgptr;
main()
{
int shmid;
shmid=shmget(SHMKEY,sizeof(mesg),0);
msgptr=(mesg *)shmat(shmid,0,0);
nread=read(0,msgptr->mesg_data,MAXDATASIZE);
msgptr->mesg_len=nread;
msgptr->mesg_type=1L;
write(1,msgptr->mesg_data,msgptr->mesg_len);
shmdt(msgptr);
shmctl(shmid,IPC_RMID,0);
}




























//Semaphores

//Header File (mysem.h)

#include
#include
#include

#define PERMS 0666
#define MHDRSIZE sizeof(mesg)-MAXDATASIZE;
#define MAXDATASIZE 1024
#define SHMKEY 4567L
#define SEMKEY1 1234L
#define SEMKEY2 2345L

typedef struct msgbuff{
int mesg_len;
long int mesg_type;
char mesg_data[MAXDATASIZE];
}mesg;
int shmid,semid;
typedef struct sembuff{
short sem_num;
short sem_op;
short sem_flg;
}semp;
static struct sembuff myop_lock[2]= {
0,0,0;
0,1,SEM_UNDO;
};
static struct sembuff myop_unlock[1]={
0,-1,SEM_UNDO;
};
Static struct sembuff op_endcrete[2]={
1,-1,SEM_UNDO;
2,-1,SEM_UNDO;
};
static struct sembuff op_lock[2]= {
0,0,0;
0,1,SEM_UNDO;
};
static struct sembuff op_open[1]= {
1,-1,SEM_UNDO;
};
static struct sembuff op_close[3]={
2, 0, 0,
2, 1, SEM_UNDO,
1, 1, SEM_UNDO
};
Static stuct sembuff op_unlock[1]={
2,-1,SEM_UNDO;
};
//sem_create
int sem_create(int key,int initval)
{
int semid,semval;
semid=semget(key,3,PERMS|IPC_CREAT);
if(initval==0)
semop(semid,&op_lock[0],2);
if((semval=semctl(semid,1,GETVAL,0))==0)
semctl(semid,1,SETVAL,BIGCOUNT)
semctl(semid,0,SETVAL,initval);
semop(semid,&op_endcreate[0],2);
return(semid);
}

//sem_open
int sem_open(int key)
{
int semid;
semid=semget(key,3,0);
if(semid<0) printf(“UNSUCCESSFULL”); semop(id,&op_open[0],1); return(semid); } //sem_close sem_close(int semid) { int semval; semop(id,&op_close[0],3); if((semval=semctl(id,1,GETVAL,0))==BIGCOUNT) sem_rm(semid); else semop(id,&op_unlock[0],1); return(semid); } //sem_wait sem_wait(int semid,value) { op_op[0].val=value semop(semid,&op_op[0],1); } //sem_signal sem_signal(int semid) { op_op[0].val=value; semop(semid,&op_ops[0],1); } //sem_rm Sem_rm(semid) { Semctl(semid,IPC_RMID,0); } //Server #include"mysem.h" main() { mesg msgptr; shmid=shmget(SHMKEY,sizeof(mesg),PERMS|IPC_CREAT); msgptr=(mesg *)shmat(shmid,0,0); clisem=sem_create(SEMKEY2,0); servsem=sem_create(SEMKEY1,1); sem_wait(clisem); server(); shmdt(msgptr); } server() { strcat(msgptr->mesg_data,"from server");
msgptr->mesg_len=strlen();
msgptr->mesg_type=2L;
sem_signal(servsem);
}


//Client

#include"mysem.h"
main()
{
Mesg msgptr;
shmid=shmget(SHMKEY,0,0);
msgptr=(Mesg *)shmat(shmid,0,0);
sem_wait(servsem);
client();
shmdt(msgptr);
shmctl(shmid,IPC_RMID,0);
sem_rm(clisem);
sem_rm(servsem);
client()
{
read(0,msgptr->mesg_data,MAXDATASIZE);
sem_signal(clisem);
sem_wait(servsem);
write(1,msgptr->mesg_data,msgptr->mesg_len);
}























//TCP client server Application

//tcp_echo header (tcp_header.h)

#include
#include
#define SERV_PORT 9999
#define MAXSIZE 1024
#define SERV_ADDR "172.16.5.80"

//readn function
readn(fd,buff,nbytes)
{
int fd,nbytes,nleft,nread;
pbuff=buff;
nleft=nbytes
while(nleft>0)
{
nread=read(fd,pbuff,nleft);
if(nread==0)
break;
if(nread<0) nleft=nleft-nread; buff=pbuff+nread; } return(nbytes-nleft); } //writen function writen(fd,buff,nbytes) { int fd,nbytes,nleft,nwrite; pbuff=buff; nleft=nbytes; while(nleft>0)
{
nwrite=write(fd,pbuff,nleft)
if(nwrite<0) nleft=nleft-nwrite; buff=pbuff+nwrite; } return(nbytes-nleft); } //tcp echo server

#include”tcp_header.h”
main()
{
int listenfd,connfd,clilen,n;
struct sockaddr_in servaddr,cliaddr;
listenfd=socket(AF_INET,SOCK_STREAM,0);
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDRANY);
servaddr.sin_port=htons(SERV_PORT);
bind(listenfd,(struct sockaddr *)&servaddr,sizeof(servaddr));
listen(listenfd,6);
for(;;)
{
clilen=sizeof(cliaddr);
connfd=accept(listenfd,(struct sockaddr *)&cliaddr,&clilen);
n=readn(connfd,buff,MAXBUFF);
writen(connfd,buff,n);
exit(0);
close(connfd);
}
}




















//tcp_echo client

#include”tcp_header.h”

main()
{
int sockfd,n;
struct sockaddr_in servaddr;
sockfd=socket(AF_INET,SOCK_STREAM,0);
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_port=htons(SERV_PORT);
servaddr.sin_addr.s_addr=htonl(inet_addr(SERV_ADDR);
connect(sockfd,(struct sockaddr *)servaddr,sizeof(servaddr));
n=read(0,buff,BUFFSIZE);
writen(sockfd,buff,n);
n=readn(sockfd,buff,BUFFSIZE);
write(1,buff,n);
close(sockfd);
}
























//UDP client server Application

//udp echo server

#include
#include
#include
#define SERV_PORT 9999
#define MAXSIZE 1024
main()
{
int nbytes,sockfd;
char buff[MAXSIZE];
struct sockaddr_in servaddr,cliaddr;
sockfd=socket(AF_INET,SOCK_DGRAM,0);
nbytes=read(0,buff,MAXSIZE);
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_port=htons(SERV_PORT);
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
bind(sockfd,(struct sockaddr *)servaddr,sizeof(servaddr));
for(;;)
{
clilen=sizeof(cliaddr);
recvfrom(sockfd,buff,MAXSIZE,(struct sockaddr *)cliaddr,&clilen);
strcat(buff,”FROM THE SERVER”);
n=strlen(buff);
sendto(sockfd,buff,n,0,(struct sockaddr *)cliaddr,sizeof(cliaddr));
}















//udp echo client

#include
#include
#include
#define SERV_PORT 9999
#define MAXSIZE 1024
main()
{
int nbytes,sockfd;
char buff[MAXSIZE];
struct sockaddr_in servaddr,cliaddr;
sockfd=socket(AF_INET,SOCK_DGRAM,0);
nbytes=read(0,buff,MAXSIZE);
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_port=htons(SERV_PORT);
servaddr.sin_addr.s_addr=htonl(Inetaddr("172.16.5.80"));
sendto(sockfd,buff,nbytes,0,(struct sockaddr *)servaddr,sizeof(servaddr));
n=recvfrom(sockfd,buff,MAXSIZE,(struct sockaddr *)cliaddr,&sizeof(cliaddr));
write(1,buff,n);
}
1) The ringtone "Nokia tune" is actually based on a 19th century guitar work named "Gran Vals" by Spanish musician Francisco Tárrega. The Nokia Tune was originally named "Grande Valse" on Nokia phones but was changed to "Nokia Tune" around 1998 when it became so well known that people referred to it as the "Nokia Tune."

2) The world's first commercial GSM call was made in 1991 in Helsinki over a Nokia-supplied network, by Prime Minister of Finland Harri Holkeri, using a Nokia phone.

3) Nokia is currently the world's largest digital camera manufacturer, as the sales of its camera-equipped mobile phones have exceeded those of any conventional camera manufacturer.

4) The "Special" tone available to users of Nokia phones when receiving SMS (text messages) is actually Morse code for "SMS". Similarly, the "Ascending" SMS tone is Morse code for "Connecting People," Nokia's slogan. The "Standard" SMS tone is Morse code for "M" (Message).

5) The Nokia corporate font (typeface) is the AgfaMonotype Nokia Sans font, originally designed by Eric Spiekermann. Its mobile phone User's Guides Nokia mostly used the Agfa Rotis Sans font.
6) In Asia, the digit 4 never appears in any Nokia handset model number, because 4 is considered unlucky in many parts of Southeast/East Asia.

7) Nokia was listed as the 20th most admirable company worldwide in Fortune's list of 2006 (1st in network communications, 4th non-US company).

8. Unlike other modern day handsets, Nokia phones do not automatically start the call timer when the call is connected, but start it when the call is initiated. (Except for Series 60 based handsets like the Nokia 6600)

9) Nokia is sometimes called aikon (Nokia backwards) by non-Nokia mobile phone users and by mobile software developers, because "aikon" is used in various SDK software packages, including Nokia's own Symbian S60 SDK.

10) The name of the town of Nokia originated from the river which flowed through the town. The river itself, Nokianvirta, was named after the old Finnish word originally meaning sable, later pine marten. A species of this small, black-furred predatory animal was once found in the region, but it is now extinct.
Objective: To get free GPRS connection on your PC/mobile.

What u need: GPRS-enabled Mobile (with AIRTEL connection only), PC, connecting cable or USB dongle or infrared device.

Procedure:

1. Activate AIRTEL LIVE on your mobile, which is provided FREE by AIRTEL (thanks them).

2. Create 2 GPRS data acountss and select first as active profile. (Go to settings, then connection, then gprs settings).

3. Now, connect your mobile to the PC.

4. Install the driver for your mobile?s modem. (you can download it from your handset company's website).

5. Create a new dial-up connection as follows:

New connection wizard, then

Connecting Device : Your mobile?s modem

ISP Name : ___ (anything you like)

Phone Number : *99***2# or *99***1#

Username and Password : ___

6. Do followng settings: Use the proxy 100.1.200.99 and port 8080.

7. Connect to the dial-up account. The whole world is at your fingertips.

Conclusion: Nothing is impossible. Your free GPRS connection is ready now.