Re: 2.2 generating odd TCP resets?

From: Brian Craft (bcboy@thecraftstudio.com)
Date: Wed Oct 18 2000 - 13:14:54 EST


Well, this seems to be half the story. If I remove the close() and
let server bleed file descriptors, the RST goes away. If I add a
read() on the socket after sending all the data, the RST goes away.

However, there's NO DATA on the socket. read() returns zero until
the client closes the socket.

In the code below, I removed the shutdown() and added the block
after do_scan() to eliminate the RST. The read() never finds any data.
If there's no data pending, why does read() have any affect?

b.c.

            fcntl (data_fd, F_SETFL, 1); /* set non-blocking */
        /* shutdown (data_fd, 0); */
            do_scan (w, h, data_fd);
            {
                char buff[10];
                int i, c;
                printf("looking for extra data\n");
                while ((c = read(data_fd, buff, 10)) >= 0) {
                    if (c > 0) {
                        for (i=0; i<c; ++i) {
                            printf("%x ", buff[i]);
                        }
                        printf("\n");
                    }
                }
                printf("no more data\n");
            }
            close (data_fd);

On Wed, Oct 18, 2000 at 10:15:24AM +0100, Tony Gale wrote:
>
> Most likely reason is that the server calls close() while there is
> still data pending to be read. As TCP is a reliable transport, this
> loss of data causes a RST.
>
> An application bug.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:13 EST