[erlang-questions] C nodes and select loops

Serge Aleynikov serge@REDACTED
Wed Nov 14 18:18:56 CET 2012


Unfortunately this is a shortcoming of the erl_interface library - it
doesn't offer any non-blocking alternatives of socket-handling functions
(e.g. erl_connect and erl_receive_msg).

If you need that and are flexible about using C++ in your project, you can
consider the following project which implements asynchronous communication
with Erlang nodes:

https://github.com/saleyn/eixx

Serge

On Wed, Nov 14, 2012 at 11:05 AM, David Welton <davidw@REDACTED> wrote:

> Hi,
>
> I expected to find an answer to this one via Google, but I didn't.
>
> I'm looking at the C node example, and it does:
>
>     while (loop) {
>         got = erl_receive_msg(fd, buf, BUFSIZE, &emsg);
>
> Which is ok if you can sit around waiting on incoming Erlang messages,
> but say you want to work with a select loop (or whatever form of
> polling/events) where you can get events from other places, as well as
> from other Erlang nodes.
>
> The ei_connect man page says:
>
>        As with all other ei functions, you are not expected to put the
>  socket
>        in non blocking mode yourself in the program. Every use of non
> blocking
>        mode is embedded inside the timeout functions. The socket  will
>  always
>        be back in blocking mode after the operations are completed
> (regardless
>        of the result). To avoid problems, leave the socket options  alone.
>  Ei
>        will handle any socket options that need modification.
>
> That makes me a bit wary...  Granted, there are the _tmo options, but
> I just wanted to ask around for advice on best practices for something
> like this.
>
> Thanks
> --
> David N. Welton
>
> http://www.dedasys.com/
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121114/b5115ac7/attachment.htm>


More information about the erlang-questions mailing list