anchor.diff:                           caller=ReplyTo}, 0}.
   
   connect(timeout, State=#state{port=Port,host=Host,message=Message}) ->
  -    lager:info("Connecting to ~p : ~p",[Host, Port]),
       case  gen_tcp:connect(Host, Port,
                                    [{active,true},binary, {packet,2}], ?TIMEOUT) of
           { ok, Socket} ->
  -            lager:info("Connected"),
               ok = inet:setopts(Socket, [{active, once}]),
               ok = gen_tcp:send(Socket, term_to_binary(Message)),
               ok = inet:setopts(Socket, [{active, once}]),
  
positive.code:     {stop, normal, StateData};
  
  handle_info(Message, _StateName, StateData) ->
      lager:debug("Unexpected message: ~p",[Message]),
      {stop,badmsg,StateData}.
  
  handle_event(_Event, _StateName, StateData) ->
  
negative.code:     {stop, normal, State}.
  
  handle_info({tcp, Socket, Bin}, StateName, #state{socket=Socket} = StateData) ->
      inet:setopts(Socket, [{active, once}]),
      gen_fsm:send_event(self(), binary_to_term(Bin)),
      {next_state, StateName, StateData}; 
  
  