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).<br><br>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:<br>
<br><a href="https://github.com/saleyn/eixx">https://github.com/saleyn/eixx</a><br><br>Serge<br><br><div class="gmail_quote">On Wed, Nov 14, 2012 at 11:05 AM, David Welton <span dir="ltr"><<a href="mailto:davidw@dedasys.com" target="_blank">davidw@dedasys.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I expected to find an answer to this one via Google, but I didn't.<br>
<br>
I'm looking at the C node example, and it does:<br>
<br>
    while (loop) {<br>
        got = erl_receive_msg(fd, buf, BUFSIZE, &emsg);<br>
<br>
Which is ok if you can sit around waiting on incoming Erlang messages,<br>
but say you want to work with a select loop (or whatever form of<br>
polling/events) where you can get events from other places, as well as<br>
from other Erlang nodes.<br>
<br>
The ei_connect man page says:<br>
<br>
       As with all other ei functions, you are not expected to put the  socket<br>
       in non blocking mode yourself in the program. Every use of non blocking<br>
       mode is embedded inside the timeout functions. The socket  will  always<br>
       be back in blocking mode after the operations are completed (regardless<br>
       of the result). To avoid problems, leave the socket options  alone.  Ei<br>
       will handle any socket options that need modification.<br>
<br>
That makes me a bit wary...  Granted, there are the _tmo options, but<br>
I just wanted to ask around for advice on best practices for something<br>
like this.<br>
<br>
Thanks<br>
--<br>
David N. Welton<br>
<br>
<a href="http://www.dedasys.com/" target="_blank">http://www.dedasys.com/</a><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br>