[Linux Network Programming learning notes] creating and using FIFO

Source: Internet
Author: User

Pipelines can only be used for communication between processes created by the same grandfather process. FIFO (first-in-first-out) is similar to pipelines and can only transmit data streams in one way. However, each FIFO has a path name associated with it, which allows communication between unrelated processes. FIFO is also known as a pipe.

FIFO is created by the mkfifo function.

# Include <sys/types. h> # include <sys/STAT. h> int mkfifo (const char * pathname, mode_t mode );

If you only open a FIFO instance instead of creating a new FIFO instance, you can call the open () function.

FIFO is the first-in-first-out mode. The read to it is always read from the beginning, and the write is always added to the end. And cannot perform lseek operations on it.

1. Implement Multi-Customer Service with FIFO

2. Restrictions on system channels and FIFO

(1) the maximum number of descriptors that a process can open at the same time is open_max.

(2) maximum data volume that can be written into the pipeline or FIFO pipe_buf

The sysconf function can be used to obtain the value of open_max (the value can be modified using the limit command in shell), while the value of pipe_buf is defined in limits. in the H header file, its value is obtained by calling pathconf or fpathconf during running.

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.