cURL / Mailing Lists / curl-library / Single Mail


Re: transfer speed control

From: Rick Jones <>
Date: Tue, 22 Oct 2002 10:53:32 -0700 (PDT)

the SO_RCVBUF setting controls haw much data a receiving TCP can store
waiting for the application (in this case libcurl) to recv() it out of
the socket buffer.
this is also the TCP window advertised to the remote sender.
the remote sender is precluded (by the specification for TCP) from
sending more than the remote receiver's advertised window's worth of
data at any one time.
once a window's worth of data is believed to be "in flight" by the
sending TCP, it must stop and wait for a window update to be returned
by the remote receiving TCP.
the remote receiving TCP will not send window updates unless/until the
remote application actually calls recv/read against the socket and
"consumes" some of the queued data.
so, if the receiving application (eg libcurl) stops calling recv(),
data will queue in the socket recv buffer (sized by SO_RCVBUF) and the
TCP window will shrink. when the window shrinks to zero, the sender
will stop until data is taken from the socket buffer.
sizing the SO_RCVBUF can indirectly control the rate at which data
flows across a TCP connection because one of the limits to the rate of
a TCP connection is the window size divided by the round-trip-time.
This is often written as W/RTT.
if W/RTT is less than the bitrate of the path between the two
endpoints, and is also smaller than the rate at which the receiving
application consumes data, and is also smaller than the rate at which
the sending application provides data, then W/RTT will be the limit of
the connection.
if the bitrate of the path is the smallest value then it is the
limit. etc etc.
rick jones

This emial is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.;4699841;7576301;v?
Received on 2002-10-23