我希望以{From(PID}, atom}
格式从python向Erlang传递消息,因为Erlang程序需要知道要向哪个进程id发送消息。在
Erlang消息循环:
message_loop([First | Rest]) ->
receive
{From, ready} ->
% From ! {self(), {read, First}},
python:cast(From, {read, First}),
message_loop(Rest);
{From, done} ->
python:cast(From, {read, First}),
message_loop(Rest);
{From, _} ->
io:format("Invalid Message Received From");
_ ->
io:format("Random Message")
end.
如何使用erport传递这样的消息?或者有没有其他技术可以用来在产生许多进程之后有选择地与进程通信?在
正如您在文档中看到的types mapping没有自动执行的选项。在
您可以使用
PID
将PID
转换为字符串表示,并将其发送给python。从python接收时,可以使用erlang:list_to_pid/1
。那就足够了。在相关问题 更多 >
编程相关推荐