anchor.diff:        Flags      :: recv_flags(),
         MsgHdr     :: msghdr(),
         SelectInfo :: select_info(),
  -      Reason     :: term()
  -                 ; (Socket, Flags, Timeout) -> {ok, MsgHdr} | {error, Reason} when
  +      Reason     :: errcode() | closed;
  +
  +             (Socket, Flags, Timeout) -> {ok, MsgHdr} | {error, Reason} when
         Socket     :: socket(),
         Flags      :: recv_flags(),
         Timeout    :: timeout(),
         MsgHdr     :: msghdr(),
  -      Reason     :: term()
  -                 ; (Socket, BufSz, CtrlSz) -> {ok, MsgHdr} | {error, Reason} when
  +      Reason     :: errcode() | closed | timeout;
  +
  +             (Socket, BufSz, CtrlSz) -> {ok, MsgHdr} | {error, Reason} when
         Socket     :: socket(),
         BufSz      :: non_neg_integer(),
         CtrlSz     :: non_neg_integer(),
         MsgHdr     :: msghdr(),
  -      Reason     :: term().
  +      Reason     :: errcode() | closed.
   
   recvmsg(Socket, Flags, Timeout) when is_list(Flags) ->
       recvmsg(Socket, 0, 0, Flags, Timeout);
  
positive.code:       Socket  :: socket(),
        Flags   :: recv_flags(),
        MsgHdr  :: msghdr(),
        Reason  :: term()
                   ; (Socket, Timeout :: nowait) -> {ok, MsgHdr} |
                                                    {select, SelectInfo} |
                                                    {error, Reason} when
        Socket     :: socket(),
        MsgHdr     :: msghdr(),
        SelectInfo :: select_info(),
        Reason     :: term()
                   ; (Socket, Timeout) -> {ok, MsgHdr} | {error, Reason} when
        Socket     :: socket(),
        Timeout    :: timeout(),
        MsgHdr     :: msghdr(),
        Reason     :: term().
  
  recvmsg(Socket, Flags) when is_list(Flags) ->
      recvmsg(Socket, 0, 0, Flags, ?ESOCK_RECV_TIMEOUT_DEFAULT);
  
negative.code: %% Flags   - A list of "options" for the read.
  %% Timeout - Time-out in milliseconds.
  
  -spec recv(Socket) ->
                    {ok, Data} |
                    {error, Reason} when
        Socket :: socket(),
        Data   :: binary(),
        Reason ::
          errcode() | closed |
          {errcode() | closed, Data :: binary()}.
                            
  recv(Socket) ->
      recv(Socket, 0).
  
  -spec recv(Socket, Length) ->
                    {ok, Data} |
                    {error, Reason} when
        Socket :: socket(),
        Length :: non_neg_integer(),
        Data   :: binary(),
        Reason ::
          errcode() | closed |
          {errcode() | closed, Data :: binary()}.
  
  recv(Socket, Length) ->
      recv(Socket, Length,
           ?ESOCK_RECV_FLAGS_DEFAULT,
           ?ESOCK_RECV_TIMEOUT_DEFAULT).
  
  -spec recv(Socket, Length, Flags) ->
                    {ok, Data} |
                    {error, Reason} when
        Socket :: socket(),
        Length :: non_neg_integer(),
        Flags  :: recv_flags(),
        Data   :: binary(),
        Reason ::
          errcode() | closed |
          {errcode() | closed, Data :: binary()};
  
            (Socket, Length, Timeout :: nowait) ->
                    {ok, Data} |
                    {ok, {Data, SelectInfo}} |
                    {select, SelectInfo} |
                    {error, Reason} when
        Socket     :: socket(),
        Length     :: non_neg_integer(),
        Data       :: binary(),
        SelectInfo :: select_info(),
        Reason     ::
          errcode() | closed |
          {errcode() | closed, Data :: binary()};
  
            (Socket, Length, Timeout) ->
                    {ok, Data} |
                    {error, Reason} when
        Socket  :: socket(),
        Length  :: non_neg_integer(),
        Timeout :: timeout(),
        Data    :: binary(),
        Reason  ::
          errcode() | closed | timeout |
          {errcode() | closed | timeout, Data :: binary()}.
  
  recv(Socket, Length, Flags) when is_list(Flags) ->
      recv(Socket, Length, Flags, ?ESOCK_RECV_TIMEOUT_DEFAULT);
  recv(Socket, Length, Timeout) ->
      recv(Socket, Length, ?ESOCK_RECV_FLAGS_DEFAULT, Timeout).
  
  -spec recv(Socket, Length, Flags, nowait) ->
                    {ok, Data} |
                    {ok, {Data, SelectInfo}} |
                    {select, SelectInfo} |
                    {error, Reason} when
        Socket     :: socket(),
        Length     :: non_neg_integer(),
        Flags      :: recv_flags(),
        Data       :: binary(),
        SelectInfo :: select_info(),
        Reason     ::
          errcode() | closed |
          {errcode() | closed, Data :: binary()};
  
            (Socket, Length, Flags, Timeout) ->
                    {ok, Data} |
                    {error, Reason} when
        Socket     :: socket(),
        Length     :: non_neg_integer(),
        Flags      :: recv_flags(),
        Timeout    :: timeout(),
        Data       :: binary(),
        Reason     ::
          errcode() | closed | timeout |
          {errcode() | closed | timeout, Data :: binary()}.
  
  recv(#socket{ref = SockRef} = Socket, Length, Flags, Timeout)
    when is_reference(SockRef),
  