anchor.diff:      app_id :: nksip:app_id(),
       transport :: nksip_transport:transport(),
       socket :: port(),
  +    tcp_pid :: pid(),
       stuns :: [{Id::binary(), Time::nksip_lib:timestamp(), term()}]
   }).
   
  
positive.code:             end;
          {rnrn, More} ->
              parse(More, Ip, Port, State);
          {error, Error} ->
              ?notice(AppId, "error ~p processing UDP msg", [Error])
      end.
  
negative.code: %% ===================================================================
  
  
  % %% @private
  start_tcp(AppId, Ip, Port, Pid) ->
      case nksip_transport:start_transport(AppId, tcp, Ip, Port, []) of
          {ok, TcpPid} -> gen_server:cast(Pid, {matching_tcp, {ok, TcpPid}});
          {error, Error} -> gen_server:cast(Pid, {matching_tcp, {error, Error}})
      end.
  
  %% @private Checks if a port is available for UDP and TCP
  -spec open_port(nksip:app_id(), inet:ip_address(), inet:port_number(), integer()) ->
      {ok, port()} | {error, term()}.
  
  open_port(AppId, Ip, Port, Iter) ->
      Opts = [binary, {reuseaddr, true}, {ip, Ip}, {active, once}],
      case gen_udp:open(Port, Opts) of
          {ok, Socket} ->
              {ok, Socket};
          {error, eaddrinuse} when Iter > 0 ->
              lager:warning("UDP port ~p is in use, waiting (~p)", [Port, Iter]),
              timer:sleep(1000),
              open_port(AppId, Ip, Port, Iter-1);
          {error, Error} ->
              {error, Error}
      end.
  
  
  