Re: sendfile()? Re: SO_LINGER dead: I get an immediate RST on 2.6.24?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeremy Jackson
Date: Friday, February 13, 2009 - 10:02 am

On Tue, 2009-01-13 at 00:31 -0500, Bill Fink wrote:

An excellent article on this subject:

http://ds9a.nl/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable.txt

"Luckily, it turns out that Linux keeps track of the amount of
unacknowledged
data, which can be queried using the SIOCOUTQ ioctl(). Once we see this
number hit 0, we can be reasonably sure our data reached at least the
remote
operating system."

is this the same as the TCP_INFO getsockopt() ?

if you follow the progression from write(socket_fd, ) ... the data sits
in
the socket buffer, and SIOCOUTQ is initially zero.  If the connection
started with a zero window,
it could sit like that for a while (sometimes called a "tarpit ?).  But,
you should still see the data in your socket buffer, yes?

So, I think you want to make sure your socket write buffer is empty
(converted to unacked data), *then* make sure your unacked data is 0.

	write(sock, buffer, 1000000);             // returns 1000000
	shutdown(sock, SHUT_WR);
	now wait for SIOCOUTQ to hit 0.

if window is 0, shutdown() would wait until show device sets window > 0
again, or forever on a tarpitted connection.  Either way, when if/when
it finishes, you know all data was transmitted, now wait for all of it
to be ACKed with SIOCOUTQ.



-- 
Jeremy Jackson
Coplanar Networks
(519)489-4903
http://www.coplanar.net
jerj@coplanar.net

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
SO_LINGER dead: I get an immediate RST on 2.6.24?, bert hubert, (Sun Jan 11, 2:23 pm)
Re: SO_LINGER dead: I get an immediate RST on 2.6.24?, H. Willstrand, (Sun Jan 11, 3:08 pm)
Re: sendfile()? Re: SO_LINGER dead: I get an immediate RST ..., Jeremy Jackson, (Fri Feb 13, 10:02 am)