In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Realization of Interprocess Communication with sockpair
We have previously learned to use pipes (anonymous pipes here) to achieve inter-process communication, which can only be one-way, one side can only read and the other can only write, and can only communicate between processes that are related by consanguine. if we want to achieve two-way communication, we must create two-way pipes, and the implementation of sockpair is two-way pipes for communication. It can be used to create a two-way communication pipeline.
1 # include 2 # include 3 # include 4 # include 5 # include 6 # include 7 # include 8 9 int main () 10 {11 int sv [2] = {0if 0}; 12 char buf [1024]; 13 int sock_pair=socketpair (AF_LOCAL,SOCK_STREAM,0,sv); 14 if (sock_pair < 0) 15 {16 perror ("socketpair"); 17 exit (1); 18} 19 pid_t id=fork (); 20 if (id)
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.