[erlang-questions] "calling" a gen_fsm

Garry Hodgson <>
Tue Sep 22 19:37:25 CEST 2015


On 9/22/15 10:21 AM, Vance Shipley wrote:
>
> Send your request, stuff From into StateData and return next_state. 
> Then you may receive the response in handle_info/3 and send it to the 
> client with reply/2.
>

On 9/22/15 10:47 AM, Theepan wrote:
> Just use {next_state,NextStateName,NewStateData} instead of 
> {reply,Reply,NextStateName,NewStateData} and keep the PID of the 
> calling process in the NewStateData. This helps you in deferring the 
> response. When the data comes form the service, you can send the 
> response back with gen_fsm:reply(PID, Reply).
>
thanks to both of you for your quick and helpful answers.
gotta love this list.





More information about the erlang-questions mailing list