当前位置:网站首页>Pipe /createpipe
Pipe /createpipe
2022-07-28 04:58:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack , I wish every programmer can learn more languages .
BOOL CreatePipe(PHANDLE hReadPipe, // Pointer to the read handle PHANDLE hWritePipe, // Pointer to the write handle LPSECURITY_ATTRIBUTES lpPipeAttributes, // Pointer to a security property DWORD nSize // Pipe size );
The Conduit (Pipe) It is actually a piece of shared memory for inter process communication , The process of creating a pipeline is called pipeline server, The process connected to a pipeline is the pipeline client . A process writes data to the pipeline , Another process can read it from the other end of the pipe . Anonymous pipeline (Anonymous Pipes) It is an unnamed pipeline for one-way data transmission between parent and child processes , It can only be used in the local computer , It can not be used for communication between networks .
The Conduit server take lpPipeAttributes Point to the SECURITY_ATTRIBUTES Data members of data structures bInheritHandle Set to TRUE, that CreatePipe() Created pipeline read 、 The write handle will be inherited
The parent process can call the process creation function CreateProcess() Generate subprocesses . Suppose the parent process wants to send data to the child process , The parent process can call WriteFile() Write data to the pipeline ( Pass pipeline write handle to function ), Child process calls GetStdHandle() Get the read handle of the pipeline , Pass this handle into ReadFile() Then read the data from the pipe .
Suppose that the parent process reads data from the child process , Then the child process calls GetStdHandle() Get the write handle of the pipeline , And call WriteFile() Write data to the pipeline . then , Parent process call ReadFile() Read data from the pipe ( Pass pipeline read handle to function ).
In use WriteFile() When the function writes data to the pipeline , The function returns only after writing the specified byte of data to the pipeline or when an error occurs . If the pipeline buffer is full and the data has not been written ,WriteFile() It will not return until another process reads the data in the pipeline to free up a lot of other available space . The Conduit server Calling CreatePipe() Create the pipe with parameters nSize The buffer size of the pipe is set .
Anonymous pipes do not support asynchronous reads 、 Write operations , This means that you can't use... In anonymous pipes ReadFileEx() and WriteFileEx(), also ReadFile() and WriteFile() Medium lpOverLapped Parameters will also be ignored . The anonymous pipeline will read 、 Exit after all write handles are closed , It can also be called in the process CloseHandle() Function to close this handle .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/118215.html Link to the original text :https://javaforall.cn
边栏推荐
- POJ 2763 housewife wind (tree chain partition + edge weighting point weight)
- Gan: generative advantageous nets -- paper analysis and the mathematical concepts behind it
- 数据库故障容错之系统时钟故障
- Artificial intelligence and RPA technology application (I) -rpa Hongji product introduction, designer interface function explanation
- What SaaS architecture design do you need to know?
- Array or object, date operation
- Redis类型
- Gerrit operation - rollback a patch_ set
- [Sylar] framework Chapter 23 summary of module chapter
- HDU 1530 maximum clique
猜你喜欢

字符串0123456789abcdef,子串(非空且非同串本身)的个数是多少【杭州多测师】【杭州多测师_王sir】...

100 lectures on Excel practical application cases (XI) - tips for inserting pictures in Excel

Analysis of the reason why easycvr service can't be started and tips for dealing with easy disk space filling

Wang Shuang assembly language detailed learning notes 3: registers (memory access)

RT_ Use of thread message queue

Machine learning and deep learning -- normalization processing

linux下安装mysql

05.01 string

(clone virtual machine steps)

Special topic of APP performance design and Optimization - poor implementation affecting performance
随机推荐
[function document] torch Histc and paddle Histogram and numpy.histogram
Tiantian AMADA CNC bending machine touch screen maintenance rgm21003 host circuit board maintenance
HDU 3666 the matrix problemdifferential constraint + stack optimization SPFA negative ring
Cloudcompare & PCL point cloud least square fitting plane
flink思维导图
基于MPLS构建虚拟专网的配置实验
Strlen introduction, and the difference between sizeof
Rendering process, how the code becomes a page (2)
linux下安装mysql
Redis类型
Method of converting UI file to py file
[Sylar] practical part - redis based parameter query service
王爽汇编语言详细学习笔记三:寄存器(内存访问)
Dcgan:deep volume general adaptive networks -- paper analysis
ADB environment configuration
RT based_ Distributed wireless temperature monitoring system of thread (I)
(克隆虚拟机步骤)
Gerrit operation - rollback a patch_ set
list indices must be integers or slices, not tuple
数据安全逐步落地,必须紧盯泄露源头