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:58:16 -0700
On Apr 28, 2004, at 10:46, Nicolas Berloquin wrote:
[snip]
first, thanks for your explaination. All those ramifications are
sometimes scary ;-)
That's part of the rush of programming :-}
This is related to my previous discussion about throttling.
If, when I'm about to send some data to a remote peer, I can know that
there is still
some data inside its send buffer, then I will postpone my send() until
the next loop.
From the way I looked at it, it seems the easiest way to handle my
bandwidth problem.
I forget - is this TCP or UDP? Trying to outsmart TCP is a waste of
effort, and generally doesn't do what you want. If it's UDP, no data
is stored in socket buffers - either it gets sent, or it gets dropped,
down in the driver layer.
But maybe I could achieve this by setting the send window size by hand
to the amount
previously sent and therefore expecting a EWOULDBLOCK if the data
wasn't already sent.
Otherwise, all the 65k are filled and I never know when they are
really sent to the peer.
You can't set the send window. That's done by the remote side.
The best you can do is to 'test' the status of the TCP connection by
putting the socket in non-blocking mode and using select if you get
EWOULDBLOCK. Control returns when the window is opened. Is that what
you mean in your remark about EWOULDBLOCK?.
You could, as an alternative, use non-blocking mode and poll, but that
is ugly and bad citizenship.
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | If you're not confused,
| You're not paying attention
*--------------------------------------*-------------------------------*
_______________________________________________
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.