Socket onread, onready, onclose event handler function in Ocaml

随声附和 提交于 2019-12-02 00:41:21

Yes. Make a loop and use Unix.select to wait for events on your fds. You will have to set your sockets to non-blocking mode with Unix.set_nonblock so that your reads and writes don't block and you can get back to your select if there's no data to read/write (because even if select returns you fds that are readable/writable it doesn't mean that a read/write on them wouldn't block).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!