I have a program with 10 children and their parent. Is there any way for the parent to send a message via msgsnd()
to a specific child? I mean, child 1 should receive msg1
, child should 2 receive msg2
, etc....
Asked
Active
Viewed 168 times
0

Jonathan Leffler
- 730,956
- 141
- 904
- 1,278

Aitor Ramos Pajares
- 361
- 2
- 20
-
Are you talking about parent/child IPC? http://stackoverflow.com/questions/14170647/fork-parent-child-communication – jiveturkey Apr 21 '17 at 18:42
-
yes, but with msgsn, no pipes – Aitor Ramos Pajares Apr 21 '17 at 18:48
-
You haven't specified enough information in the question for anyone to be able to answer. What IPC mechanisms are you planning to use? Are there any artificial constraints on what you can use? – Jonathan Leffler Apr 21 '17 at 18:50
-
Can I use different type of msgsnd to each child receive his message independently – Aitor Ramos Pajares Apr 21 '17 at 18:57
-
Note that you need to decide, in part, how the children are going to receive the message. The [`msgrcv()`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/msgrcv.html) function allows you to control which messages are received, so by allocating each of the 10 children a number, you can send a message that only the child will receive. So the answer to "Can I use a different type of `msgsnd()` message to each child" is yes. – Jonathan Leffler Apr 21 '17 at 18:58