Subject: Determination of TCP send buffer queue
To: None <tech-net@netbsd.org>
From: Stuart Brooks <stuartb@cat.co.za>
List: tech-net
Date: 04/06/2001 08:37:24
I'm new to this group and not sure if this is the right place to post for
this but I would appreciate if anyone has any suggestions.

I am working on a problem involving transmission of gsm audio across low
bandwidth links (ppp, typically 19.2 - 33kbps) using TCP. In order to be
able to structure my transmission of other (non-audio) data across other TCP
connections I need a relatively accurate indication of current level in the
send buffer.

I have found the FIONREAD ioctl which can determine the receive buffer
level, but can't find anything similiar for getting the send buffer level.
Having a look through Stevens TCP/IP Vol 2, and the kernel I see that the
so->so_snd.sb_cc stores the "actual characters in the buffer" but this also
includes the sent-but-unacknowledged data as well.

My questions are
1. Is there an easy way to extract this information from the kernel?
2. Is it possible to find out how much of the data in the buffer is still to
be sent without stepping through the mbuf chain?

I would greatly appreciate any suggestions or help ...
Sincerely
 Stuart Brooks