anchor.diff:      gen_tcp:send(Sock, iolist_to_binary(IoList)).
   
   %% @doc receive binary data of specified number of bytes length.
  -recv_data(_, 0) -> <<>>;
  +recv_data(_, 0) -> {ok, <<>>};
   recv_data(Sock, NumBytes) ->
       case gen_tcp:recv(Sock, NumBytes) of
           {ok, Bin} -> {ok, Bin};
  
positive.code: 
  -record(msg, {cmd = "",
                key = "",
                flag = 0,
                expire = 0,
                cas = 0,
  
negative.code:                      Data, <<"\r\n">>],
                RecvCallback).
  
  get_recv(Sock, RecvCallback) ->
      Line = recv_line(Sock),
      case Line of
          {error, _}=Err -> Err;
          {ok, <<"END\r\n">>} -> Line;
          {ok, <<"VALUE ", Rest/binary>>} ->
              Parse = io_lib:fread("~s ~u ~u\r\n", binary_to_list(Rest)),
              {ok, [Key, Flag, DataSize], _} = Parse,
              {ok, Data} = recv_data(Sock, DataSize + 2),
              if is_function(RecvCallback) -> RecvCallback(Line,
                                                           #msg{key=Key,
                                                                flag=Flag,
                                                                data=Data});
                 true -> ok
              end,
              get_recv(Sock, RecvCallback)
      end.
  
  %% @doc send an iolist and receive a single line back.
  send_recv(Sock, IoList) ->
      send_recv(Sock, IoList, undefined).
  