Вопрос

I'd like to connect erlang to an external C# program. I know that there are various ways to do this, 1) use ports (provided by OTP), 2) TCP/UDP/networking sockets, 3) os:cmd, etc. Options 1 and 3 assume that erlang is starting these programs, and option 2 requires a lot of setup if you just want to interact with an external program.

The question is this: does erlang allow ports to be created & connected to already running programs? I know that this introduces some interesting security issues, but the idea sounds doable so I thought I'd see if someone's tried to do this before.

Thanks

Это было полезно?

Решение

Its pretty much only sockets you could use, or mmap some shared memory and acces it from a NIF or port driver. But shared memory is not very good for fault isolation.

If its possible to start your external program as port this would bring you the advantage of automatic restarts when the owner process is supervised.

One other possibility is using a C-Node or in your case maybe a C# Node, I.e. speaking Erlangs distribution protocol from programs in different languages.

Другие советы

There is another option, which i don't personally recommend, but it's still there; CORBA http://www.erlang.org/doc/man/corba.html (Common Object Request Broker Architecture).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top