[zeromq-dev] Erlang Ports and zmq_poll

Serge Aleynikov serge at aleynikov.org
Thu Jul 22 02:50:46 CEST 2010


If the current in-process implementation of Erlang ZeroMQ binding 
doesn't work for you (is it because you are concerned with stability 
issues?) you can certainly take advantage of zmq_poll() for 
communicating with an Erlang VM through a pair of pipes.  See this 
tutorial on how to accomplish that task with a simple C program:

On the port side, you need to add two file descriptors 0 and 1 to the 
event sets given to zmq_poll() call and check for ZMQ_POLLIN or 
ZMQ_POLLOUT on corresponding file descriptors when zmq_poll() call 
returns (just as the manual says: http://api.zeromq.org/zmq_poll.html).

There's nothing special about this use of zmq_poll() for writing a port 


On 7/21/2010 8:58 AM, Matthew Metnetsky wrote:
> Hi Chris,
> On Wed, 2010-07-21 at 03:48 +0000, chris wrote:
>> Matthew Metnetsky<met<at>  uberstats.com>  writes:
>>> I was wondering if anyone has used zmq_poll() as the communication loop
>>> for an Erlang port? If so, any pointers?
>> Beyond that, Sustrik's zeromq is not fully stable yet.  In my testing, I'm not
>> confident in running any type of system using erlang and zeromq at this point.
>> I don't see this flushing out for several more weeks at least - really dependent
>> on Serge or Dhammika becoming interested in bringing the bindings up to snuff.
>> I've done what I could to make it *work*, but at this point I am looking at
>> other solutions for my needs as this combination of technology isn't going to
>> become mature enough in my time frame.
>> Out of curiosity, you said "Erlang Ports" in plural. What ones are you aware of?
> Thanks for the information, but I guess I wasn't very clear. I'm going
> to need to create a erlang port (1) and was looking to replace the hard
> read() loop with zmq_poll() and was wondering if anyone had done it.
> It's basically a select() replacement, but as I'm very new to 0MQ I
> figured there might be some pointers worth being aware of.
> Thanks,
> ~ Matthew
> (1) http://www.erlang.org/documentation/doc-5.8/doc/tutorial/c_port.html
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list