OpenWrt ubus 不阻塞(4):用 ustream 管 socket,别手动拆 read/write
官方 examples/client.c 用 ustream_fd 接管 fd,notify_read 时按行解析;ustream 负责非阻塞、边沿触发、读写缓冲和半包。本文拆这个例子,并给出完整 TCP socket 回显实现,说明为什么不需要把每次 write 拆成状态机。
共 1 篇
官方 examples/client.c 用 ustream_fd 接管 fd,notify_read 时按行解析;ustream 负责非阻塞、边沿触发、读写缓冲和半包。本文拆这个例子,并给出完整 TCP socket 回显实现,说明为什么不需要把每次 write 拆成状态机。
用 RSS 阅读器订阅,有新文章会自动出现。
技术问题、文章反馈、合作线索,去留言板。