October 26th, 2008, 11:48 PM
Implementing mesage queue between client and server. Help!!!
I need to implement client and server in message queue as follows: when the client send a command to the server via message queue, the server execute the command, and send the output of the command back to the client via message queue. then the client display the message. Here is my question. When the server execute the command, let say "ls", how do you store the output into a char array so that you can send the output back via message queue. I try popen(), system(). None of them give me what I want. They execute the command and send the output to stdout.
October 27th, 2008, 12:05 AM
Have you tried redirecting the output to either a temp file or stdin?
October 27th, 2008, 12:42 AM
What is a "message queue" precisely? Are you using a particular protocol?
October 27th, 2008, 07:56 AM
It is a message structure that is part of ipc (inter process communication).
Originally Posted by fuzzybunny
I am trying to redirect stdout now, but if I can avoid it, that would be great. Any more suggestion?
October 27th, 2008, 08:42 AM
Please show us some code to highlight what you are attempting precisely.
Originally Posted by KingdomHeart
October 27th, 2008, 11:22 AM
I figure out the solution. I use popen(). It give me the file descriptor pointer. From there, I can do fgetc to read from the file descriptor pointer and store the buffer array. Thank you very much for the input