Questions tagged [msgrcv]

A system call used to receive messages from a message queue in Linux. Similarly, Msgsnd() is the respective system call used to send messages. Use this tag for questions related to the system call msgrcv()

A system call used to receive messages from a message queue in Linux. Similarly, Msgsnd() is the respective system call used to send messages. Use this tag for questions related to the system call msgrcv()

35 questions
3
votes
2 answers

Can't send integer from one process to another using POSIX in C

I am using C language with GCC compiler on Linux. I have two processes, and I want to pass integer from one process to another i.e from external process to central process and than central process should print it. But my code is not working. Can…
Taimour
  • 459
  • 5
  • 21
2
votes
3 answers

Message Passing In C/Printing a char array from a struct in C

I created this program to pass a message to a parent process. I want the parent process to print out the message it receives. I'm not sure if this is an issue with reading the char array or message passing as I am quite new to programming in c. Here…
Matt_Bro
  • 14,062
  • 2
  • 28
  • 41
1
vote
2 answers

How to fix the error Permission denied while using msgrcv in C

I want to make a programm in C that receive a message from messaging queue. I have the existing code here : typedef struct { long id; char mes[20]; } message; int main() { key_t cle = ftok(".",0); if(cle == -1){ …
TheHangel
  • 21
  • 1
1
vote
1 answer

excluding multiple message using MSG_EXCEPT at once in msgrcv()

I am using msgrcv() to read messages from a queue. There are multiple threads, each handling its own message type from a common queue. Lets say there are 3 threads handling message type A, B and C respectively as below: ` thread1() { msg_t msg; …
1
vote
1 answer

Can't find the solution for my guessing game

I'm making a different version of my guessing game. This time, the child process has to send it's guess to the parent, which then evaluates that. What I think I'm doing wrong is that my child only runs once, but can't figure out how to get guesses…
1
vote
1 answer

UNIX message queue msgrcv failed to receive message

Dear Friends, Any idea why the msgrcv is receiving a blank buffer? Here is the code: enter code here #include #include #include #include #include typedef struct mymsg { long mtype; …
RajSanpui
  • 11,556
  • 32
  • 79
  • 146
1
vote
1 answer

Why msgsnd() and msgrcv() can't run well?

The msgsnd() and msgrcv() are in the same function, it works well like the first example. main.c #include #include #include int main(int argc, char *argv[]) { pid_t pid1; pid_t pid2; pid_t pid3; …
mHuster
  • 11
  • 1
1
vote
1 answer

C Linux (Ubuntu) - msgsnd() and msgrcv() errno 22 (EINVAL)

I'm trying my hand at IPC (message passing) for a while now, and I'm unable to resolve this problem. errno 22 (EINVAL) for msgget() seems to be Invalid message queue identifier, nonpositive message type, or invalid message size. Now, errno 22 for…
patricio2626
  • 147
  • 1
  • 3
  • 17
1
vote
0 answers

Error during the communication on a msg queue

I made a message queue, but when assistant send the message to his client, the client received wrong number: -1081388352. This is for every number I send. There is no error during the msgget and even durign msgcrv or msgsnd. The code for the…
user3266496
  • 23
  • 1
  • 3
1
vote
2 answers

IPC msgrcv - receiving only two specific types of messages

I've got a problem. I have a process, let's say it is a client, and a process called server. Client and server communicate with each other by the same queue. Let's say a client sends a message to the server (request), so the server processes it and…
Adam Wolski
  • 5,448
  • 2
  • 27
  • 46
0
votes
1 answer

Interrupted system call

I have more then three timer running from main as given below, and I have defined one message queue in main section. My timer's expiration time in 10(max). Why, when timer expires "msgrcv" gives error like "Interrupted system call"? timer_t…
prashant mavadiya
  • 176
  • 1
  • 2
  • 9
0
votes
0 answers

Why msgrcv does not save recieved values in structure?

I have two programs: server.c, and c1.c. Server should be running infinitely, and other programs, like c1.c, should send the number to the server, and get the square of that number as a server answer. The problem with my two programs is that server…
kims9
  • 45
  • 1
  • 4
0
votes
0 answers

Multiple entries of message queue with same key and msgqid

I am practicing the IPC message Queue, I have written Below program to send and fetch message from the queue. Program is working fine on Linux Platform. But when I run the Program on WSL in windows, I see multiple entries ipcs -q with same key and…
Hackaholic
  • 19,069
  • 5
  • 54
  • 72
0
votes
0 answers

How to use one message queue for multiple processes?

As the title says I'm trying to create a C++ program in linux (Ubuntu) which communicates using the msgget function. This program creates multiple processes using the fork() function and I want each process to be able to communicate with each other…
Diego Esquivel
  • 182
  • 1
  • 12
0
votes
0 answers

How does a receiving process actually receive a process from a sender process via message queues?

I'm working on a project with a sender and receiver process using shared memory and a message queue. For the life of me, I cannot get the receiver process to receive the file, but i can't figure out what's actually going wrong. It seems like it's…
1
2 3