Message Queuing provides a way to send a block of data from one process to another. Each block of data is considered to be of a type, and the data blocks accepted by the recipient process can have different types of values. We can avoid the synchronization and blocking problems of named pipes by sending messages. Message Queuing is message-based, and Message Queuing reads are not necessarily first-in-first-out. The maximum length of each message is capped, the total number of bytes per message queue is capped, and the total number of message queues on the system has an upper limit.
The steps are as follows:
1): Create a new message queue or get an existing message queue
2): Read and write messages to the queue
3): Set Message Queuing properties
Comm.h
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/ED/wKiom1cM68mwH85IAAC46mbAeVk769.jpg "title=" Linux.jpg "alt=" Wkiom1cm68mwh85iaac46mbaevk769.jpg "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7E/ED/wKiom1cM7GvA8EDbAABNA4DLglI904.jpg "title=" Linux.jpg "alt=" Wkiom1cm7gva8edbaabna4dlgli904.jpg "/>
Comm.c
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/7E/ED/wKiom1cM7aDjmGngAAEOi0kyBPU735.jpg "title=" linux1 . JPG "alt=" Wkiom1cm7adjmgngaaeoi0kybpu735.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/7E/ED/wKiom1cM7n3TpMCdAACdyIkghyA462.jpg "title=" linux2 . JPG "alt=" Wkiom1cm7n3tpmcdaacdyikghya462.jpg "/>
Sever.c
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7E/EB/wKioL1cM8ISxjeUMAACcQckpPjM454.jpg "title=" Linux3.jpg "alt=" Wkiol1cm8isxjeumaaccqckppjm454.jpg "/>
Client.c
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7E/EB/wKioL1cM8T-jbIY4AAB1I4SvSfY022.jpg "title=" Linux4.jpg "alt=" Wkiol1cm8t-jbiy4aab1i4svsfy022.jpg "/>
Operation Result:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/EE/wKiom1cM8qXSnBzIAABnrfFmVpc287.jpg "title=" Linux5.jpg "alt=" Wkiom1cm8qxsnbziaabnrffmvpc287.jpg "/>
This article is from the "fringe" blog, so be sure to keep this source http://ab6107.blog.51cto.com/10538332/1763183
Message Queuing for inter-process communication under Linux