[erlang-questions] Two-way ports?

Oliver Korpilla Oliver.Korpilla@REDACTED
Fri Nov 18 11:33:19 CET 2016


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?

Thanks and best regards,
Oliver



More information about the erlang-questions mailing list