[Haskell-cafe] Unexpected behaviour with send and send-buffer setting

Joey Adams joeyadams3.14159 at gmail.com
Wed Sep 4 01:58:55 CEST 2013

On Tue, Sep 3, 2013 at 6:56 PM, Simon Yarde <simonyarde at me.com> wrote:

> I'm new to Haskell and have reached an impasse in understanding the
> behaviour of sockets.
> The crux of my line of enquiry is this;  how can my application know when
> to pause in generating its chunked output if send doesn't block and the
> current non-blocking send behaviour apparently succeeds when the send
> buffer should be full?

'send' will eventually block after enough 'send's without matching
'recv's.  As Brandon explains, there is more buffering going on than the
send buffer.  In particular, the receiving host will accept segments until
its buffer fills up.  TCP implements flow control (i.e. keeps the sender
from flooding the receiver) by having the receiver tell the sender how many
more bytes it is currently willing to accept.  This is done with the
"window size" value in the TCP segment header [1].

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130903/06427ff7/attachment.htm>

More information about the Haskell-Cafe mailing list