• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

Inter process Communication(IPC)-Client Code

April 4, 2011 by ProjectsGeek Leave a Comment

Inter process Communication(IPC) client Server  Code Operating System Problem

 

Inter process Communication Client Code using C language

 

  • Interprocess Communication for Producer Consumer problem in UNIX (Pipes or Shared Memory)
  • Students must submit the term work in the form of journal.
  • Each assignment has to be well documented with problem definition, theory and code documentation.
  • Staff in charge will assess the assignments continuously and grade or mark each assignment on completion date declared for each assignments.

IPC Client Code using C language

 

 #include  
 #include  
 #include  
 #include  
 #define SIZE 124  
 int main()  
 {  
   char *buff,*str;  
   buff=(char*)malloc(124);  
   str=(char*)malloc(124);  
 *str='\0';    
 int shmid,i=0;  
   if((shmid=shmget(9999,SIZE,IPC_CREAT|0666))<0)  
   printf("\nERROR IN SHMID\n");  
   if((buff=shmat(shmid,NULL,0))<0)  
     printf("ERROR IN SHM ATTACH\n");  
 while(1)  
   {  
     if(*str!='\0')  
     {  
     printf("\nTHE SERVER JUST SEND THIS MESSAGE\n\n");  
     fputs(str,stdout);  
     break;  
     }  
 strncpy(str,buff,SIZE);  
   }  
 *str='\0';  
 *buff='\0';  
 printf("\nREPLY \n\n");  
 fgets(str,SIZE,stdin);  
 strncpy(buff,str,SIZE);  
 sleep(1);  
 *buff='\0';  
 return(0);  
 }  
 Server   
 #include  
 #include  
 #include  
 #include  
 #define SIZE 124  
 int main()  
 {  
   char *buff,*str;  
   buff=(char*)malloc(124);  
   str=(char*)malloc(124);  
   int shmid;  
   if((shmid=shmget(9999,SIZE,IPC_CREAT|0666))<0)  
   printf("\nERROR IN SHMID\n");  
   if((buff=shmat(shmid,NULL,0))<0)  
     printf("ERROR IN SHM ATTACH\n");  
   printf("\nWRITE YOUR MSG\n");  
   fgets(str,SIZE,stdin);  
   strncpy(buff,str,SIZE);  
 sleep(1);  
 *buff='\0';  
 *str='\0';  
 printf("\n SERVER IS WAITING FOR REPLY........\n");  
 while(1)  
 {  
 if(*str!='\0')  
 {  
 printf("\nCLIENT JUST GAVE REPLY\n");  
 fputs(str,stdout);  
 break;  
 }  
 strncpy(str,buff,SIZE);  
 }  
   return(0);  
 }

 

Other Projects to Try:

  1. Regular Expression to DFA Code in C Language
  2. Lexical analyzer Code in C Language
  3. Dijkstra Algorithm in C Language
  4. string operations such as Copy, Length, Reversing, Palindrome, Concatenation
  5. Macro Processor Pass Two in C Language

Filed Under: Operating System

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy