In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Named pipes are designed for communication between unrelated processes
Open (".. / share_fifo", O_RDONLY, 777); this opens a named pipe as read-only, which causes blocking and does not continue to execute open (".. / share_fifo", O_RDONLY | O_NONBLOCK, 777) until other processes are opened for writing. This is opened as read-only and marked as non-blocking, open will not cause blocking, causing the read () function to leave open (fifo,O_WRONLY, 777) after reading the data and then block to other read to open the pipe open (fifo,O_WRONLY | O_NONBLOCK, 777) without blocking, if there is no other read to open the pipe will immediately return an error-1 ENXIO to write a read-free open pipe will produce a signal SIGPIPE You can capture the signal for subsequent processing of this routine, and the function for the communication program between a service process and multiple client processes needs to be perfected one step.
Server.c
# include # define MAXLINE 100pid_t str_handler (char*); void handler_client_corrupt (int); static char* itoa (int); / / because itoa is a non-standard C function, you need to define void del_fifo (void) yourself; / / delete int main () {int fd;int count = 10int BUF_SIZE;pid_t client_id when exiting / / delete the pipeline if (atexit (del_fifo)) {perror ("atexit\ n"); exit (1);} # if 1Take / create a client-to-server shared live pipeline that must not have if (0! = mkfifo (".. / share_fifo", 0777)) {perror ("mkfifo\ n"); exit (1);} fputs ("share_fifo has been created\ n", stdout) # endif// open the pipe and set read-only fd = open (".. / share_fifo", O_RDONLY, S_IRUSR | S_IRGRP | S_IROTH); if (fd PIPE_BUF)? (BUF_SIZE = PIPE_BUF): (BUF_SIZE = MAXLINE); / / the maximum amount of data written into fifo by atomic operations, which will lead to competitive MAXLINE.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.