Asynchronous Ocaml/异步套接字问题
我是OCaml的新手,正在使用Async/Core开发一个小型TCP客户机实用程序 使用打开连接Asynchronous Ocaml/异步套接字问题,asynchronous,ocaml,Asynchronous,Ocaml,我是OCaml的新手,正在使用Async/Core开发一个小型TCP客户机实用程序 使用打开连接 Tcp.with_connection(Tcp.Where_to_connect.of_host_和_port{host=“localhost”;port=myPort}) 我需要能够接受键盘输入,以及从插座读取输入。为此,我使用Deferred.any 在套接字上调用Reader.read Reader buf会导致`Eof,这是正常的,但是当递归调用该方法(包含Deferred.any代码)时,
Tcp.with_connection(Tcp.Where_to_connect.of_host_和_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”)
.....
读取器上的已关闭
返回false。
如何在没有此异常的情况下递归地“监视”套接字
迈克尔