Drivers that drive me mad...

Dan Gudmundsson dgud@REDACTED
Wed Aug 23 08:13:59 CEST 2000

Bruce Fitzsimons writes:

 > Everything worked fine until I sent a command to erlogic.erl and it
 > translated it and sent a command to the driver port (like a pid...but
 > different) port ! {self(), {command, {"xxx"}}}. At this point the driver
 > crashed and took the loop with it. I couldn't trap any message from it.
 > After a few days of mucking around with this, I decided that maybe the
 > process that opens a port should send the commands to it. And it
 > works....yay!

It must not be the process who opened the port that sends to the 
port, but it must be it's Pid you sending as the first element 
in the tuple.
Port ! {OpenPortPid, {command, ...}}.

Answers to the port always comes to the opening process, so that's 
why you almost always have a erlang-process synchronizing things to the port.

There are a couple of options you can use to get a message when 
the port dies, see the man page. But I have had problems with 
that before but I don't remember when and why..(on linux maybe)


More information about the erlang-questions mailing list