lkml.org 
[lkml]   [2002]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: socket write(2) after remote shutdown(2) problem ?
    On Fri, Apr 05, 2002 at 04:04:51AM -0800, David S. Miller wrote:

    > As you can see, read() doesn't return any error, just 0 to
    > indicate end-of-file (seems correct interpretation of remote
    > shutdown here), but it doesn't report any error from the
    > precedent write... Bug ?
    >
    > Race, wait a bit, the reset will arrive.

    Ok, I investigated this a bit more using setsockopt(...,SO_ERROR,...)

    After the write in the client (which is done after the server has
    shutdown()'ed it), the error bit is set on the client socket
    (-EPIPE).

    If the client issues a second write, the write fails (correctly)
    setting errno to -EPIPE.

    If the client issues a read, read doesn't return an error. The
    socket error bit is still there however, even after read() returns.

    If the client issues a close, close will return 0 too.

    Whether the read() should return the error bit or not is
    debatable, but IMHO close at least should propagate the error.

    Stelian.
    --
    Stelian Pop <stelian.pop@fr.alcove.com>
    Alcove - http://www.alcove.com
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:25    [W:0.040 / U:0.544 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site