When looking at abcast abcast man page,
and cast cast man page, I couldn't understand what's the difference between those two.
Can someone clarify this to me.
Thanks
A gen_server is a specific finite state machine working like a server. gen_server can handle different type of event: synchronous request with handle_call. asynchronous request with handle_cast. other message (not defined in OTP specification) with handle_info.
stop() -> exit(?
There are three differences between gen_server:cast/2 and gen_server:abcast/2,3:
gen_server:abcast/3 takes a list of target nodes specifying where gen_server instances registered by the specified name might be found, while gen_server:abcast/2 sends to the list [node() | nodes()], whereas gen_server:cast/2 can address only a single gen_server instance.gen_server:abcast/2,3 takes only a name, as an atom, whereas gen_server:cast/2 can take an atom, a pid, or for the global and via options, any Erlang term.gen_server:abcast/2,3 returns abcast, whereas gen_server:cast/2 returns ok.The first difference is the most important, as it allows for an asynchronous broadcast (i.e., abcast) to a set of gen_server instances across a set of nodes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With