Question: In this project you need to apply message queue concepts to allow two processes to send message between each other. The code included to this

In this project you need to apply message queue concepts to allow two processes to send message between each other. The code included to this project is doing the message queue code for two processes. You need to allow the sender to send message and enter waiting as soon as it did not receive acknowledgment from the receiver, and he will send again a new message as he receive acknowledgment. Note: you need to allow both processes to be sender and receiver at the same time by initiating two message queues for sending and receiving.

Note: use the following Flow-chart to understand the issue

In this project you need to apply message queue concepts to allow

Note: please import the code into you device and run it.

See the example of running both sender and receiver

two processes to send message between each other. The code included to

this project is doing the message queue code for two processes. You

need to allow the sender to send message and enter waiting as

soon as it did not receive acknowledgment from the receiver, and he

will send again a new message as he receive acknowledgment. Note: you

need to allow both processes to be sender and receiver at the

Start WHILE INPUT :- * Sender Receiver Send Fest Message ONLY Acknowlegment Message Queue YES Acknowledge It Message Queur SNED Message 1 IfAKNOW -NO WAIT instructor advancedprogramming: -/Documents/advanced programming/ShA-X instructor advancedprogramming: Documents/advanced programming/Sh - X File Edit View Search Terminal Help File Edit View Search Terminal Help instructor advancedprogramming:-/Documents/advanced_programming/Shared Memory$/instructor advancedprogramming:-/Documents/advanced programming/Shared Memorys/ sender receiver Enter a message:myname is mahmoud myname is mahmoud Message sentinstructor advancedprogramming:-/Documents/advanced_programing/Shar instructor advancedprogramming:-/Documents/advanced_programming/SharedMenorys edMemory Sender code: #include #include #include #include #include #include #define MAXSIZE 128 /* To send a message, there should be a message buffer. The Clibrary has provided a default template structure "msgbuf" that is present in "sys/msg.h" *7 typedef struct long mtype; char mtext[MAXSIZE] }msgbuf; int main(void) // key_t key:// ftok-convert a pathname and a project identifier to a System V IPC key //key=ftok("file.txt", "b"); 1/printf("Key %d", key); int msgid; key_t key=123456; int msgflag-IPC_CREAT0666; msgbuf buf; size_t buflen; iff(msgid=msgget(key,msgflag]} #include #include #include #include #include #define MAXSIZE 128 1 To send a message, there should be a message buffer. The C library has provided a default template structure "msgbuf" that is present in sys/msg." *7 typedef struct long mtype; char mtext[MAXSIZE); msgbuf; int main(void) //key_t key:// ftok-convert a pathname and a project identifier to a System V IPC key // key=ftok("file.txt", "b"); // printf("Key%d", key); int msgid; key_t key=123456; int msgflag=IPC_CREAT0666; msgbuf buf; iff(msgid=msgget(key,0666))(O) perror("message queue error"); if(msgrev/msgid,&buf, MAXSIZE,1,0)(0) { perror("Cant receive message"); }else{ printf("%s ", buf.mtext); 1 return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!