原理:https://www.yubaike.com.cn/html/server/unix/341187.html

demo:https://blog.csdn.net/hbsyaaa/article/details/127504803
https://www.yubaike.com.cn/html/server/unix/341187.html
https://zhuanlan.zhihu.com/p/473590839

API

https://blog.csdn.net/weixin_28673511/article/details/129984153

socketpair()函数

用于创建一对相互连接的套接字。它可以用于在同一个进程内部进行进程间通信。这两个套接字可以通过索引0和1在同一个进程内进行通信。其中,索引0的套接字用于读取数据,索引1的套接字用于写入数据。
https://www.yisu.com/ask/36273021.html
https://www.cnblogs.com/bandaoyu/p/16752367.html

struct msghdr

https://blog.csdn.net/qq_41453285/article/details/89810683/

错误整理

  • bind fail
    若套接字接口文件存在,那么bind函数会出错,我们可以先把该文件删掉(使用unlink函数).

  • error: value of type '__bind<int &, sockaddr *, unsigned long>' is not contextually convertible to 'bool'
    https://www.zhihu.com/question/40365500/answer/86200585

socket bind函数和c++11 std::bind冲突了


0 条评论

发表回复

您的电子邮箱地址不会被公开。