Re: close() with queued receive data loses transmit data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David S. Miller wrote:
From: Jens David <dg1kjd@afthd.tu-darmstadt.de>
Date: Thu, 28 Nov 2002 10:11:08 +0100
Now how do I make sure that between my last read() and the close()
system call no more data arrives? Sounds like a race condition to me.

The client and server must agree on what is to be sent/received.

Or do I have to make sure on higher protocol layers that this situation
does not occur?

That's right.
I disagree.  The two directions of a TCP connection are independent.  Data
can flow in one direction reliably even if the other direction is completely
ignored.  If I don't want rx data I shouldn't have to read it just to keep
the kernel from losing the tx data I give it.

But... to work around the problem and avoid a race or an assumption about
what the other side will do, you just have to make sure the tx queue is
empty before you close.  Is there a better way to do that than the
"shutdown(SHUT_WR) then read() until EOF" method?

Jim

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux