Unix.error 31在使用Functory模块时编写

时间:2017-01-04 18:06:47

标签: unix ocaml

我正在使用functory模块,我面临着一个非常离奇的代码问题。

我的代码工作正常,我已经能够在我的游戏中并行化游戏,但是当我再次尝试再次播放时(另一次启动并行功能),它会引发一个非常奇怪的错误。

在这里你可以找到错误:

Fatal error: exception Unix.Unix_error(43, "write", "")
Raised by primitive operation at file "unix.ml", line 252, characters 7-34
Called from file "protocol.ml", line 45, characters 10-32
Re-raised at file "network.ml", line 536, characters 10-11
Called from file "network.ml", line 565, characters 47-80
Called from file "list.ml", line 73, characters 12-15
Called from file "network.ml", line 731, characters 4-27
Called from file "map_fold.ml", line 98, characters 4-242
Called from file "game_ia.ml", line 111, characters 10-54
Called from file "gameplay.ml", line 34, characters 12-48
Called from file "gameplay.ml", line 57, characters 22-37
Called from file "gameplay.ml", line 85, characters 5-22

所以我决定在以下文件夹中搜索以查看引发的原始操作:

(unix.ml) external rename : string -> string -> unit = "unix_rename"
(network.ml) Some jid when w.state <> Disconnected -> send w (Protocol.Master.Kill jid)

因此,出于某种原因,我的工作人员似乎自行断开连接。我想知道你们中是否有人已经遇到过这个问题以及为了解决这个问题该怎么办?

你可以找到我的游戏here。涉及的主要文件是game_ia.ml(best_move_parallelized)和gameplay.ml(在最底部)。

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

你得到的错误是(在toploop中键入以下内容)¹:

# (Obj.magic 43: Unix.error);;
- : Unix.error = Unix.EPROTOTYPE

表示:协议错误类型的套接字。因此,您必须检查如何初始化套接字。

¹您还可以计算unix.mli中的例外情况,因为第一个E2BIG0。 Emacs C-u 43 ↓有帮助。