[erlang-questions] Two-way ports?

Michael Truog mjtruog@REDACTED
Fri Nov 18 20:23:56 CET 2016

On 11/18/2016 02:33 AM, Oliver Korpilla wrote:
> Hello.
> I'm trying to solve the following problem:
> I have to use an external mechanism available in C to send and receive messages.
> The API provides:
> * Some basic startup functions registering this Unix process as an entity in that message framework.
> * Registering for a specific ID to receive messages under.
> * A non-blocking send.
> * A blocking receive.
> Is this something I could in theory manage through a port?
> I want to:
> 1) Setup the initial startup (done always).
> 2) Register a specific ID.
> 3a) Receive messages asynchronously from the process.
> 3b) Send messages into the port for immediate delivery.
> Can this be done in one port? Does it need two ports? Can it be done with ports at all or elegantly?

This can be done in one port.  However, it is much easier to use the CloudI C API for this functionality.  There is a small example at http://cloudi.org/#C .

Best Regards,

More information about the erlang-questions mailing list