This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help: shutdown(..., SHUT_WR) on TCP sockets


* Sergey Organov:

> Hello,
>
> I've got a few problems properly closing TCP sockets on GLIBC/Linux/ARM,
> and getting to the manual only added to the overall confusion.
>
> First, the manual[*] doesn't even mention SHUT_WR, etc. constants,
> instead it has raw numbers:
>
>      The argument HOW specifies what action to perform:
>
>      '0'
>           Stop receiving data for this socket.  If further data arrives,
>           reject it.
>
>           [...]
>
>
> That seems quite outdated.
>
> 2. The SHUT_WR (=1) specification seems to be plain wrong:
>
>      '1'
>           Stop trying to transmit data from this socket.  Discard any
>           data waiting to be sent.  Stop looking for acknowledgement of
>           data already sent; don't retransmit it if it is lost.
>
>
> Discarding data contradicts both the intended usage of the feature and
> the actual behavior (as observed by testing the state of the socket
> write queue using 'ioctl(fd, TIOCOUTQ, &val)' call before and after
> shutdown()).
>
> Given the above, could please somebody clarify what is the actual
> intended behavior of shutdown(..., SHUT_WR) on GLIBC/Linux nowadays?

Thanks for raising the issue.  I posted a patch to libc-alpha.

What you saw is the expected behavior for the mainline Linux kernel.
Since this is what distributions ship, I think it makes sense to
document it.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]