On Wed, Dec 20, 2000 at 07:50:02PM +0100, Olaf Titz wrote: > Two quick questions to help me understand and deal with TCP output > buffering. > > As tcp(7) says, TIOCOUTQ "Returns the amount of unsent data in the socket > send queue". Under Linux 2.2 it returns quite the opposite - the amount of > free space in the buffer. 2.4 calls it SIOCOUTQ, #define'd to be identical, > and seems to return the value as documented. Is this right? This means the > call is rather useless... It is just a known bug in 2.2. Only workaround currently is to add a small test: after you open the socket before you did any writes do a SIOCOUTQ and check if it is > 0 and distingush the cases. > > Another thing: say I want to keep data in an application send buffer > until I get an ACK on the application level. Can I be _sure_ that the > needed buffer size is bounded by the value I get from getsockopt(SO_SNDBUF)? > sock_getsockopt() seems to agree (fortunately)... No you cannot. The could be more data buffered on the remote end that has been already acked and is thus not included anymore in the sndbuf estimate. -Andi - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org