Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Two-way Communication between processes-- sockpair

2025-03-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Sockpair is a socket that can be used for network communication as well as local inter-process communication.

Sockpair is similar to pipes, except that pipes are used for one-way communication and can only be read on one side and written on the other. If you want to use it for two-way communication between processes, you need to pipe twice and create two pipes. Sockpair can directly realize two-way communication between processes.

1 # include 2 # include 3 # include 4 # include 5 # include 6 # include 7 int main () 8 {9 int fd [2] = {0 int sock 0}; 10 int sock = socketpair (AF_LOCAL,SOCK_STREAM,0,fd); 11 if (sock)

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report