I though that shutdown acts as below:
------
Syntax:
int shutdown(int sockfd, int howto);
returns 0 if OK, -1 on error.

Action of the function depends on the value of howto -
SHUT_RD - read half of the connection is closed. The data currently in the
socket receive buffer is discarded.
SHUT_WR - write half of the connection is closed. The data in the socket send
buffer is sent followed by the normal TCP connection termination sequence.
SHUT_RDWR - both read and write halves of the connection are closed.
------
( from
http://www.google.com/search?q=cache:B6qVFvpm-p4C:www.ncst.ernet.in/~netfac/PGDI
T/ppt/IOmultiplex.ppt+Unix+socket+programming+shutdown+SHUT_WR&hl=en&ie=UTF8)

SUSv2 is annoyingly somewhat vague on the specifics.

Perhaps you were thinking of SHUT_RD as discarding data? My patch used only
SHUT_WR, so it should be safe unless the above is totally wrong.

I've just done a quick test with my patch on Linux, and didn't see any problem.


Max.


Martin Pool <[EMAIL PROTECTED]> wrote:
> From memory, "Practical TCP Programming" says that this behaviour is
> caused by a misunderstanding of the sockets API by the WinSock
> programmers.  The correct meaning of shutdown() on Unix is to throw
> away any outstanding data and close the socket immediately.  Normally,
> when you close a socket, you do want to let any pending data get
> across, so it's rarely used.
>
> On Windows shutdown() does not throw away data, and should be called.
> (Trust M$ to get it backwards and force everybody else to adapt.)
>
> So the patch cannot go in as is, because I think it will break Unix.
> Something like it can go in, #ifdefed for W32.

Attachment: smime.p7s
Description: application/pkcs7-signature

Reply via email to