anchor.diff:  tcp_query(Host,Port,Packet) ->
       {ok, Socket} = gen_tcp:connect(Host, Port, [binary, {active,false}]),
       gen_tcp:send(Socket, Packet),
  -    Output = gen_tcp:recv(Socket,0,500),
  +    {Flag,Result} = gen_tcp:recv(Socket,0,500), 
  +    case Flag of
  +        ok ->
  +            case byte_size(Result) of
  +                2 ->
  +                    <<Output:16/integer>> = Result;
  +                _ ->
  +                    <<Length:32/integer, Payload/binary>> = Result,
  +                    case byte_size(Payload) < Length of
  +                        true ->
  +                            Output = gen_tcp:recv(Socket,Length,500);
  +                        false ->
  +                            Output = {ok,Payload}
  +                    end
  +            end;
  +        error ->
  +            case Result of
  +                closed ->
  +                    Output = unregistered_stream;
  +                timeout ->
  +                    Output = casted
  +            end
  +    end,
       gen_tcp:close(Socket),
       Output.
   
  
positive.code:         {call,?MODULE,request_stream,[proper_utils:streamname()]},
          {call,?MODULE,request_stream_with_size,[pos_integer(),proper_utils:streamname()]},
          {call,?MODULE,append,[proper_utils:streamid(S),list(integer(32,255))]},
          {call,?MODULE,simple_query,[proper_utils:streamid(S),S#state.starttime,timestamp_wrapper()]},
          {call,?MODULE,all_since,[proper_utils:streamid(S),S#state.starttime]},
          {call,?MODULE,last_entry_at,[proper_utils:streamid(S),timestamp_wrapper()]}
      ]).
  
  
negative.code:                     false
              end;
          _ ->
              true
      end;
  postcondition(_S, _V, _Result) ->
      true.
  
  %%-----------------------------------------------------------------------------
  