Regarding whether the channel encapsulates sendmsg() and recvmsg() functions
zixiai opened this issue · comments
english:
Does the channel provide encapsulation of sendmsg() and recvmsg() functions to pass file descriptors (such as anonymous shared memory file descriptors) between processes using Uinx domain sockets? The existing framework seems to communicate using read()/write() or send()/rece() ..., and I haven't found an interface to pass file descriptors yet. I want to modify the source code, but I don't know how to get started.
中文:
channel是否提供sendmsg()和recvmsg()函数的封装,以便使用Uinx域套接字在进程之间传递文件描述符(例如匿名共享内存文件描述符)?现有的框架似乎使用read()/write()、send()/rece()等进行通信,我没有发现传递文件描述符的接口。我想修改源代码,但不知道如何下手。
可以使用hio_t* io = hio_get(loop, fd);
通过fd拿到io对象
然后就可以使用hio_read
、hio_write
读写了
没有封装sendmsg
和recvmsg
,你可以使用hio_add(io, cb, HV_READ)
函数监听读事件,然后在回调里去自行调用recvmsg
接收数据