@@dextutor Same problem, I am not getting output of second program.. I did on linux virtual box.. Receiver program is not responding, it is not receiving the message.. i checked all syntax.. from video and blog both.. please give solution...on how to run on virtual box linux/Ubuntu?
HI! Can you please tell me why do I need to create a structure to send the message when I am using message queues? I mean, there is no such requirement while sending messages using shared memory, then why do I require it here? Would be grateful if you reply :)
Message queues send blocks of data from one process to another. Each block is considered to have a "type". Thus for each data block there will be two things: data and type. Ao, structure is the best way to define two values with an object
Just my 1 rupee opinion/comment & please take it FWIW. This is a good introductory program for new learners. In an real world programming scenario, like in a good software development company - in the mq_send.c file being shown in this youtube video, we should set the integer variable "running" to 0 if the msgget() system call fails. This will ensure that the program prints the error message related to Message Queue creation failure and does not even enter the "while(running)" loop. Otherwise the program will enter the while loop and all the messages obtained from the user input will never ever get sent to the receiver program. I do see that there is an exit(0) line when Message Queue creation is a failure in the mq_send.c source code file in your indicated website. Here too , the usage of "exit(0)" indicates a success in the execution of the program. But for this failure scenario we can use either a non-zero positive integer or a simpler "exit(EXIT_FAILURE)" to indicate the program suffered a failure. One more missing item is the return value for the main() function in mq_send.c file.This program should return an integer (indicating a success or failure) when it exits from the while() loop.
Not in file but in the variable named "buffer". Whatever data you input using keyboard will be saved in buffer and then we copy it from buffer using strcpy into some_text
Thanks a lot sir for helping.
Your Teaching is superb.
This video is very nice, it help me to understand message queue!
Sir, I don't know why but I'm unable to get the output for the second (recieve) program . I'm doing it on ubuntu in my windows os
This will not work in WSL in windows ( the one which you are using) for this program you need a pure Linux environment
@@dextutor Same problem, I am not getting output of second program.. I did on linux virtual box.. Receiver program is not responding, it is not receiving the message.. i checked all syntax.. from video and blog both.. please give solution...on how to run on virtual box linux/Ubuntu?
Please share the command that you are using to run the programs..
Also drop a mail at dextutor@gmail.com with snapshots ..
@@shivanisrivastava6360 changing key_t to the same in both files helped
I am unable to send void* type data inside a structure and getting output as segmentation fault
Check your code
HI! Can you please tell me why do I need to create a structure to send the message when I am using message queues? I mean, there is no such requirement while sending messages using shared memory, then why do I require it here? Would be grateful if you reply :)
Message queues send blocks of data from one process to another. Each block is considered to have a "type".
Thus for each data block there will be two things: data and type. Ao, structure is the best way to define two values with an object
hello sir, i tried executing this program in ubuntu app on my windows OS, it did not create any message queue, what could be the reason?
Because WSL does not support SysV message queues
Just my 1 rupee opinion/comment & please take it FWIW.
This is a good introductory program for new learners.
In an real world programming scenario, like in a good software development company - in the mq_send.c file being shown in this youtube video, we should set the integer variable "running" to 0 if the msgget() system call fails. This will ensure that the program prints the error message related to Message Queue creation failure and does not even enter the "while(running)" loop. Otherwise the program will enter the while loop and all the messages obtained from the user input will never ever get sent to the receiver program.
I do see that there is an exit(0) line when Message Queue creation is a failure in the mq_send.c source code file in your indicated website. Here too , the usage of "exit(0)" indicates a success in the execution of the program. But for this failure scenario we can use either a non-zero positive integer or a simpler "exit(EXIT_FAILURE)" to indicate the program suffered a failure.
One more missing item is the return value for the main() function in mq_send.c file.This program should return an integer (indicating a success or failure) when it exits from the while() loop.
As you rightly pointed out its an introductory program for beginners, so the things are kept simple and minimal.
sir, fgets means is it storing in a file?
Not in file but in the variable named "buffer". Whatever data you input using keyboard will be saved in buffer and then we copy it from buffer using strcpy into some_text
@@dextutor thank you sir
Hey great content,
But please update your site
I do not feel safe in going to your site through my office laptop
Is this complete playlist of os ..
Yes
Sir are you from lpu?