Thu Nov 29 16:11:22 CET 2001
On 29 Nov 2001 14:52:58 GMT, Vlad Dumitrescu wrote:
> Going through the JInterface code, I found myself a little confused
> about when to use OtpNode and OtpSelf. They seem like a kind of
> "client" and "server" nodes (with regard to connecting to other
> nodes), but is it possible to have both in a node, so that one can
> both connect to other nodes and accept incoming connections? Or did
> I miss something?
The difference has to do with how much each of these will do behind
the scenes for you.
OtpSelf and OtpPeer require you to manage all connections and dispatch
messages yourself. OtpSelf represents "this" node and OtpPeer
represents other nodes that it communicates with. OtpSelf can be both
client and server, however it will only accept incoming connections or
set up outgoing ones when you tell it to explicitly.
OtpNode came later and introduced mailboxes. It also represents "this"
node. It starts a daemon thread to manage connections for you, i.e. it
will accept all incoming connections, and make outgoing ones as
necessary when you send messages to other nodes. It will also dispatch
incoming messages to the appropriate mailboxes.
There is some more information in the package description:
(all one line)
g o r d o n . b e a t o n @ e r i c s s o n . c o m
More information about the erlang-questions