SlideShare a Scribd company logo
1 of 2
Could someone help me with this Linux system program. Using C language.
Write your own simple client/server set of processes. The client should use a shared memory
segment to send a command message to the server. The server process should monitor the shared
memory segment, and respond as follows:
"HI" -- The server prints "Greetings" to the screen.
"PID" -- The server prints it's process id to the screen.
"QUIT" -- The server terminates gracefully, detaching and releasing the shared memory
segment.
Sample run:
Client :
Server:
HI PID QUIT
Solution
#include #include #include #include #include #include #include #include #include #include int
main(int argc, char *argv[]) { int listenfd = 0, connfd = 0; struct sockaddr_in serv_addr; char
sendBuff[1025]; time_t ticks; listenfd = socket(AF_INET, SOCK_STREAM, 0);
memset(&serv_addr, '0', sizeof(serv_addr)); memset(sendBuff, '0', sizeof(sendBuff));
serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(5000); bind(listenfd, (struct sockaddr*)&serv_addr,
sizeof(serv_addr)); listen(listenfd, 10); while(1) { connfd = accept(listenfd, (struct
sockaddr*)NULL, NULL); ticks = time(NULL); snprintf(sendBuff, sizeof(sendBuff), "%.24s 
", ctime(&ticks)); write(connfd, sendBuff, strlen(sendBuff)); close(connfd); sleep(1); } }
Could someone help me with this Linux system program- Using C language.docx

More Related Content

Similar to Could someone help me with this Linux system program- Using C language.docx

Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 
Code Red Security
Code Red SecurityCode Red Security
Code Red SecurityAmr Ali
 
CentOS Linux Server Hardening
CentOS Linux Server HardeningCentOS Linux Server Hardening
CentOS Linux Server HardeningMyOwn Telco
 
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docxeugeniadean34240
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comVan-Duyet Le
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.pptEloOgardo
 
CUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : NotesCUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : NotesSubhajit Sahu
 
Netcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beemaNetcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beemaRaghunath G
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016Chris Simmonds
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure CallNadia Nahar
 
#Include os - From bootloader to REST API with the new C++
#Include os - From bootloader to REST API with the new C++#Include os - From bootloader to REST API with the new C++
#Include os - From bootloader to REST API with the new C++IncludeOS
 
CODE FOR echo_client.c A simple echo client using TCP #inc.pdf
CODE FOR echo_client.c A simple echo client using TCP  #inc.pdfCODE FOR echo_client.c A simple echo client using TCP  #inc.pdf
CODE FOR echo_client.c A simple echo client using TCP #inc.pdfsecunderbadtirumalgi
 
Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2Chef
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18Max Kleiner
 
NodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayNodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayEdureka!
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Windows Developer
 

Similar to Could someone help me with this Linux system program- Using C language.docx (20)

Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
Net Programming.ppt
Net Programming.pptNet Programming.ppt
Net Programming.ppt
 
InSpec Keynote at ChefConf
InSpec Keynote at ChefConfInSpec Keynote at ChefConf
InSpec Keynote at ChefConf
 
Code Red Security
Code Red SecurityCode Red Security
Code Red Security
 
CentOS Linux Server Hardening
CentOS Linux Server HardeningCentOS Linux Server Hardening
CentOS Linux Server Hardening
 
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 
Network Prog.ppt
Network Prog.pptNetwork Prog.ppt
Network Prog.ppt
 
CUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : NotesCUDA Tutorial 01 : Say Hello to CUDA : Notes
CUDA Tutorial 01 : Say Hello to CUDA : Notes
 
Book
BookBook
Book
 
Netcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beemaNetcat 101 by-mahesh-beema
Netcat 101 by-mahesh-beema
 
Netcat - 101 Swiss Army Knife
Netcat - 101 Swiss Army KnifeNetcat - 101 Swiss Army Knife
Netcat - 101 Swiss Army Knife
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure Call
 
#Include os - From bootloader to REST API with the new C++
#Include os - From bootloader to REST API with the new C++#Include os - From bootloader to REST API with the new C++
#Include os - From bootloader to REST API with the new C++
 
CODE FOR echo_client.c A simple echo client using TCP #inc.pdf
CODE FOR echo_client.c A simple echo client using TCP  #inc.pdfCODE FOR echo_client.c A simple echo client using TCP  #inc.pdf
CODE FOR echo_client.c A simple echo client using TCP #inc.pdf
 
Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2
 
Maxbox starter18
Maxbox starter18Maxbox starter18
Maxbox starter18
 
NodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin WayNodeJS : Communication and Round Robin Way
NodeJS : Communication and Round Robin Way
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 

More from mrichard5

A rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docx
A rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docxA rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docx
A rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docxmrichard5
 
A soil is shaken with water and then allowed to stand- After standing-.docx
A soil is shaken with water and then allowed to stand- After standing-.docxA soil is shaken with water and then allowed to stand- After standing-.docx
A soil is shaken with water and then allowed to stand- After standing-.docxmrichard5
 
a societal right- None of the above- a group right- Both A and B- an i.docx
a societal right- None of the above- a group right- Both A and B- an i.docxa societal right- None of the above- a group right- Both A and B- an i.docx
a societal right- None of the above- a group right- Both A and B- an i.docxmrichard5
 
A simple camera telephoto lens consists of two How far behind the conc.docx
A simple camera telephoto lens consists of two How far behind the conc.docxA simple camera telephoto lens consists of two How far behind the conc.docx
A simple camera telephoto lens consists of two How far behind the conc.docxmrichard5
 
A priniciple purpose of a representation letter from management is to-.docx
A priniciple purpose of a representation letter from management is to-.docxA priniciple purpose of a representation letter from management is to-.docx
A priniciple purpose of a representation letter from management is to-.docxmrichard5
 
A process or task in Linux is represented by a Answer data structure-S.docx
A process or task in Linux is represented by a Answer data structure-S.docxA process or task in Linux is represented by a Answer data structure-S.docx
A process or task in Linux is represented by a Answer data structure-S.docxmrichard5
 
Crystal clear water sports has 14-000 shares of $1 par value common st.docx
Crystal clear water sports has 14-000 shares of $1 par value common st.docxCrystal clear water sports has 14-000 shares of $1 par value common st.docx
Crystal clear water sports has 14-000 shares of $1 par value common st.docxmrichard5
 
Critical thinking question- what structural features (hint- there are.docx
Critical thinking question- what structural features (hint- there are.docxCritical thinking question- what structural features (hint- there are.docx
Critical thinking question- what structural features (hint- there are.docxmrichard5
 
Create an array of size 10 Assign values to the array Print the arra.docx
Create an array of size 10  Assign values to the array  Print the arra.docxCreate an array of size 10  Assign values to the array  Print the arra.docx
Create an array of size 10 Assign values to the array Print the arra.docxmrichard5
 
Create a text file that contains ten person objects where each object.docx
Create a text file that contains ten person objects where each object.docxCreate a text file that contains ten person objects where each object.docx
Create a text file that contains ten person objects where each object.docxmrichard5
 
Create a polynomial function that meets the following conditions- Expl.docx
Create a polynomial function that meets the following conditions- Expl.docxCreate a polynomial function that meets the following conditions- Expl.docx
Create a polynomial function that meets the following conditions- Expl.docxmrichard5
 
Create a method assuming we have a listed list- use linear search in j.docx
Create a method assuming we have a listed list- use linear search in j.docxCreate a method assuming we have a listed list- use linear search in j.docx
Create a method assuming we have a listed list- use linear search in j.docxmrichard5
 
Create a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docxCreate a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docxmrichard5
 
Create a Java Applet that uses two integer (int) variables x and y to.docx
Create a Java Applet that uses two integer (int) variables x and y to.docxCreate a Java Applet that uses two integer (int) variables x and y to.docx
Create a Java Applet that uses two integer (int) variables x and y to.docxmrichard5
 
Create a function called findChar that will return the index of where.docx
Create a function called findChar that will return the index of where.docxCreate a function called findChar that will return the index of where.docx
Create a function called findChar that will return the index of where.docxmrichard5
 
Contrast the argument that terrorist acts are easy to predict with the.docx
Contrast the argument that terrorist acts are easy to predict with the.docxContrast the argument that terrorist acts are easy to predict with the.docx
Contrast the argument that terrorist acts are easy to predict with the.docxmrichard5
 
contemporary financial management What are the differences between the.docx
contemporary financial management What are the differences between the.docxcontemporary financial management What are the differences between the.docx
contemporary financial management What are the differences between the.docxmrichard5
 
Constants Part A By measurement you determine that sound waves are spr.docx
Constants Part A By measurement you determine that sound waves are spr.docxConstants Part A By measurement you determine that sound waves are spr.docx
Constants Part A By measurement you determine that sound waves are spr.docxmrichard5
 

More from mrichard5 (18)

A rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docx
A rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docxA rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docx
A rigid- well-insulated gas cylinder contains N0 moles of an ideal gas.docx
 
A soil is shaken with water and then allowed to stand- After standing-.docx
A soil is shaken with water and then allowed to stand- After standing-.docxA soil is shaken with water and then allowed to stand- After standing-.docx
A soil is shaken with water and then allowed to stand- After standing-.docx
 
a societal right- None of the above- a group right- Both A and B- an i.docx
a societal right- None of the above- a group right- Both A and B- an i.docxa societal right- None of the above- a group right- Both A and B- an i.docx
a societal right- None of the above- a group right- Both A and B- an i.docx
 
A simple camera telephoto lens consists of two How far behind the conc.docx
A simple camera telephoto lens consists of two How far behind the conc.docxA simple camera telephoto lens consists of two How far behind the conc.docx
A simple camera telephoto lens consists of two How far behind the conc.docx
 
A priniciple purpose of a representation letter from management is to-.docx
A priniciple purpose of a representation letter from management is to-.docxA priniciple purpose of a representation letter from management is to-.docx
A priniciple purpose of a representation letter from management is to-.docx
 
A process or task in Linux is represented by a Answer data structure-S.docx
A process or task in Linux is represented by a Answer data structure-S.docxA process or task in Linux is represented by a Answer data structure-S.docx
A process or task in Linux is represented by a Answer data structure-S.docx
 
Crystal clear water sports has 14-000 shares of $1 par value common st.docx
Crystal clear water sports has 14-000 shares of $1 par value common st.docxCrystal clear water sports has 14-000 shares of $1 par value common st.docx
Crystal clear water sports has 14-000 shares of $1 par value common st.docx
 
Critical thinking question- what structural features (hint- there are.docx
Critical thinking question- what structural features (hint- there are.docxCritical thinking question- what structural features (hint- there are.docx
Critical thinking question- what structural features (hint- there are.docx
 
Create an array of size 10 Assign values to the array Print the arra.docx
Create an array of size 10  Assign values to the array  Print the arra.docxCreate an array of size 10  Assign values to the array  Print the arra.docx
Create an array of size 10 Assign values to the array Print the arra.docx
 
Create a text file that contains ten person objects where each object.docx
Create a text file that contains ten person objects where each object.docxCreate a text file that contains ten person objects where each object.docx
Create a text file that contains ten person objects where each object.docx
 
Create a polynomial function that meets the following conditions- Expl.docx
Create a polynomial function that meets the following conditions- Expl.docxCreate a polynomial function that meets the following conditions- Expl.docx
Create a polynomial function that meets the following conditions- Expl.docx
 
Create a method assuming we have a listed list- use linear search in j.docx
Create a method assuming we have a listed list- use linear search in j.docxCreate a method assuming we have a listed list- use linear search in j.docx
Create a method assuming we have a listed list- use linear search in j.docx
 
Create a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docxCreate a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docx
 
Create a Java Applet that uses two integer (int) variables x and y to.docx
Create a Java Applet that uses two integer (int) variables x and y to.docxCreate a Java Applet that uses two integer (int) variables x and y to.docx
Create a Java Applet that uses two integer (int) variables x and y to.docx
 
Create a function called findChar that will return the index of where.docx
Create a function called findChar that will return the index of where.docxCreate a function called findChar that will return the index of where.docx
Create a function called findChar that will return the index of where.docx
 
Contrast the argument that terrorist acts are easy to predict with the.docx
Contrast the argument that terrorist acts are easy to predict with the.docxContrast the argument that terrorist acts are easy to predict with the.docx
Contrast the argument that terrorist acts are easy to predict with the.docx
 
contemporary financial management What are the differences between the.docx
contemporary financial management What are the differences between the.docxcontemporary financial management What are the differences between the.docx
contemporary financial management What are the differences between the.docx
 
Constants Part A By measurement you determine that sound waves are spr.docx
Constants Part A By measurement you determine that sound waves are spr.docxConstants Part A By measurement you determine that sound waves are spr.docx
Constants Part A By measurement you determine that sound waves are spr.docx
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Could someone help me with this Linux system program- Using C language.docx

  • 1. Could someone help me with this Linux system program. Using C language. Write your own simple client/server set of processes. The client should use a shared memory segment to send a command message to the server. The server process should monitor the shared memory segment, and respond as follows: "HI" -- The server prints "Greetings" to the screen. "PID" -- The server prints it's process id to the screen. "QUIT" -- The server terminates gracefully, detaching and releasing the shared memory segment. Sample run: Client : Server: HI PID QUIT Solution #include #include #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int listenfd = 0, connfd = 0; struct sockaddr_in serv_addr; char sendBuff[1025]; time_t ticks; listenfd = socket(AF_INET, SOCK_STREAM, 0); memset(&serv_addr, '0', sizeof(serv_addr)); memset(sendBuff, '0', sizeof(sendBuff)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(5000); bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); listen(listenfd, 10); while(1) { connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); ticks = time(NULL); snprintf(sendBuff, sizeof(sendBuff), "%.24s ", ctime(&ticks)); write(connfd, sendBuff, strlen(sendBuff)); close(connfd); sleep(1); } }