asynchronous - Ocaml / 异步套接字问题
问题描述
我对 OCaml 很陌生,我正在使用 Async/Core 开发一个小型 TCP 客户端实用程序。
使用打开连接
Tcp.with_connection (Tcp.Where_to_connect.of_host_and_port { host = "localhost"; port = myPort })
我需要能够接受键盘输入,以及从套接字读取输入。为此,我使用 Deferred.any。
调用Reader.read reader buf
套接字会导致 `Eof,这没关系,但是当递归调用方法(包含 Deferred.any 代码)时,我得到一个异常:
“unhandled exception in Async scheduler”
(“unhandled exception”
((monitor.ml.Error
(“can not read from reader” (reason “in use”)
.....
Reader.is_closed
在阅读器上返回 false。如果没有这个例外,我怎样才能递归地“监视”套接字?
迈克尔
解决方案
推荐阅读
- automation - 如何在 Automation Anywhere Enterprise Client 中停止正在运行的任务?
- solr - 如何在 solr 中搜索时忽略点和其他字符
- mysql - sql获取中间记录
- react-native - 使用 URI 反应原生图像未在设备上显示
- excel - 运行时错误 438 消息确定 LastRow
- bash - cURL 从文件中读取 URL - 进程休眠
- django - 在 django 中验证上传文件
- c# - .Net jQuery WYSIWYG 隐藏在 AJAX 回发上
- php - 未定义的属性:App\User::$login using Jenssegers\Mongodb
- latex - 基本 Miktex - QWindowsWindow::setGeometry: 无法设置几何 451x317+1010+537