interprocess communication (Message Queuing)

Source: Internet
Author: User

Message Queuing: It provides a way for a process to send a block of data to another process. Each block of data can be considered a type, and the receiver can receive the corresponding block of data through different types. It is provided by the operating system buffer. is message-based. You can avoid blocking problems with named pipes by sending messages.

The Comm.h file declares five function interfaces, creates and frees message queues, obtains message queues, and receives messages from message queues.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7E/E2/wKiom1cLkzXRMXv0AABNkfIi5pI048.png "style=" float: none; "title=" QQ picture 20160411200407.png "alt=" Wkiom1clkzxrmxv0aabnkfii5pi048.png "/>

//comm.c File Create a message queue with Msgget or get a message queue that already exists.

Generate key value with Ftok, key equals a port number

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/DF/wKioL1cLlaSCh-isAABNuBP_oEU765.png "title=" QQ picture 20160411201352.png "alt=" Wkiol1cllasch-isaabnubp_oeu765.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7E/E2/wKiom1cLk4zySc9QAAA4f5NM_Fs492.png "title=" QQ picture 20160411200329.png "alt=" Wkiom1clk4zysc9qaaa4f5nm_fs492.png "/>

Use Ipc_rmid to remove Message Queuing for Message Queuing identifiers from the kernel

/ /server.c File

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/DF/wKioL1cLk-rhxVuqAABAez33wdE877.png "title=" QQ picture 20160411200531.png "style=" Float:none; "alt=" Wkiol1clk-rhxvuqaabaez33wde877.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7E/E2/wKiom1cLk_ijx3SyAAAqSNJuTdY482.png "title=" QQ picture 20160411200550.png "style=" Float:none; "alt=" Wkiom1clk_ijx3syaaaqsnjutdy482.png "/>

CLIENT.C file

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/E2/wKiom1cLlUHQ3G_dAABR_OCLPPs272.png "title=" QQ picture 20160411201517.png "alt=" Wkiom1clluhq3g_daabr_oclpps272.png "/>

Operation Result: 650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/E2/wKiom1cLmD_y-JFpAAAtbbqLKv8956.png "title=" QQ picture 20160411202805.png "alt=" Wkiom1clmd_y-jfpaaatbbqlkv8956.png "/>


interprocess communication (Message Queuing)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.