SolomonS
SolomonS

Reputation: 227

Erlang - Connect to already running external programs?

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

Upvotes: 0

Views: 207

Answers (2)

user
user

Reputation: 719

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).

Upvotes: 0

Peer Stritzinger
Peer Stritzinger

Reputation: 8372

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.

Upvotes: 1

Related Questions