Named Pipes for interprocess communication

Source: Internet
Author: User

Named pipe its practical or API functions, I think the bottom line should be the operating system allocated a separate memory space, two programs or more than one program can read and write this memory.

These so-called pipeline API functions are the way our programmers manipulate these memory spaces.

Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

API functions Used

When the pipeline server first calls the CreateNamedPipe () function, the nmaxinstance parameter is used to specify the maximum number of pipeline instances that can exist concurrently. The server can repeatedly call the CreateNamedPipe () function to create a new instance of the pipeline until it reaches the maximum number of instances set. The following is a function prototype for CreateNamedPipe ():

HANDLE createnamedpipe (             lpctstr lpname,//Pointer to pipe name              DWORD Dwopenmode,//Pipe open mode              DWORD Dwpipemode,//Piping mode C3/>dword nmaxinstances,//MAX instance number              DWORD noutbuffersize,//output cache size              DWORD ninbuffersize,//input cache size              DWORD Ndefaulttimeout,//timeout setting              lpsecurity_attributes lpsecurityattributes//security attribute pointer              );

The purpose has been realized, see Xinxin Sun's book in detail VC + + in layman's

First step: Create a solution
Step Two: Add two dialog box programs
Step three: Add the List Edit button control, modify the ID and caption, and adjust the respective positions.
Fourth step: Complete the code of a
Fifth step: Complete the Code of B
Sixth step: Adjust the code of the Create pipeline for a
Seventh step: Compile debug Run result OK

Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PostScript: The above function is only the feasibility of testing the pipeline function, in order to achieve stable and reliable communication.
The following improvements need to be made:
1) Create a worker thread, constantly listen to the data pipeline inside, if any, immediately processing, otherwise the time is long the cache will be full
2)

Xxxxxxxxxxxxxxxx

The source code is as follows: Link: Http://pan.baidu.com/s/1gdrpzeN Password: 7in5

Named Pipes for interprocess communication

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.