anchor.diff:    ok = ranch:accept_ack(Ref),
     Protocol = proplists:get_value(protocol, Opts),
     {ok, Pattern} = re:compile(?PATTERN),
  -  loop(#state{protocol = Protocol, socket = Socket, transport = Transport, pattern = Pattern}).
  +  loop(#device_state{protocol = Protocol, socket = Socket, transport = Transport, timeout = infinity, pattern = Pattern}).
   
   % echo "39. wialon"
   % (echo -n -e "#D#030816;142342;5354.33140;N;02730.14582;E;0;0;0;NA;NA;NA;NA;;NA;NA\r\n";) | nc -v localhost 5003
  -loop(State = #state{protocol = Protocol, socket = Socket, transport = Transport, device = Device, pattern = Pattern}) ->
  -  case Transport:recv(Socket, 0, infinity) of
  +loop(State = #device_state{protocol = Protocol, socket = Socket, transport = Transport, timeout = Timeout, deviceId = DeviceId, pattern = Pattern}) ->
  +  case Transport:recv(Socket, 0, Timeout) of
       {ok, Data} ->
         em_logger:info("[packet] unit: ip = '~s' data: ~s", [em_hardware:resolve(Socket), Data]),
         [_, Head, Body] = binary:split(Data, [<<"#">>], [global]),
  
positive.code:       end,
        loop(State);
      _ ->
        Transport:close(Socket)
    end.
  
  parse(<<"L">>, Data, _) ->
    case binary:split(Data, [<<";">>], []) of
  
negative.code:   >>
  ).
  
  %%-record(state, {protocol, transport, socket, timeout, device, pattern}).
  
  start_link(Ref, Socket, Transport, Opts) ->
    Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]),
  