Re: quantity in send queue ?
Re: quantity in send queue ?
- Subject: Re: quantity in send queue ?
- From: Justin Walker <email@hidden>
- Date: Wed, 28 Apr 2004 10:07:00 -0700
On Apr 28, 2004, at 9:32, Nicolas Berloquin wrote:
I can't find where to get the amount of data currently laying in a
socket's TCP send queue.
I found this on the net (about linux), but I'm not sure this is the
right way to go (I always get error -1) :
Since you haven't had much programming experience with Unix systems, a
few hints:
- '-1' as an error return from "system calls" (those described
in section 2 of the manual - as in "man 2 ...") generally means
that 'errno' is set to the actual error. These are defined
in /usr/include/sys/errno.h.
- without knowing what errno is, we have a hard time helping you
diagnose your problem
int error = ioctl(s, TIOCOUTQ, &value);
- in this case, we're lucky. IOCTLs are specific to parts of the
"I/O subsystem". Commands of the form TIOC* (or those using
't' in their definition) are specific to the terminal subsystem.
For sockets, you want things of the form SIOC*.
And, finally, I don't know of a "good" way to find out what is in the
transmit queue for your socket. Commands like 'netstat' can get this
information, but they do it by (a) running as root; and (b) copying up
the socket structure from the kernel, and interpreting the information
in that structure.
One can get the count of bytes queued to be read, but not sent.
Generally, this is an uninteresting number. What are you trying to
achieve? There may be another (better) way to get there.
Regards,
Justin
--
/~\ The ASCII Justin C. Walker, Curmudgeon-at-Large
\ / Ribbon Campaign
X Help cure HTML Email
/ \
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.