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

2013-09-05 Thread Simon Yarde
Well I'm always happy to take a public pasting in return for the chance to learn something :) It's fair to say I didn't fully understand the implications of TCPs flow-control mechanisms re buffering capacity, and I've been grateful to be guided here. > On 4 Sep 2013, at 16:52, Bryan O'Sullivan

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

2013-09-04 Thread Bryan O'Sullivan
On Tue, Sep 3, 2013 at 3:56 PM, Simon Yarde wrote: > I'm new to Haskell and have reached an impasse in understanding the > behaviour of sockets. > Your question is actually not related to Haskell at all, but is a general "I don't understand socket programming" question. You're being misled by th

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

2013-09-03 Thread Simon Yarde
> On 4 Sep 2013, at 00:49, Gregory Collins wrote: > If the underlying write operation returns EWOULDBLOCK then the "send" > function calls into the GHC IO manager with "threadWaitWrite", which > registers interest in the file descriptor using epoll() and blocks the > calling Haskell thread unti

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

2013-09-03 Thread Brandon Allbery
On Tue, Sep 3, 2013 at 7:58 PM, Joey Adams wrote: > On Tue, Sep 3, 2013 at 6:56 PM, Simon Yarde 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 g

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

2013-09-03 Thread Joey Adams
On Tue, Sep 3, 2013 at 6:56 PM, Simon Yarde 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

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

2013-09-03 Thread Gregory Collins
On Wed, Sep 4, 2013 at 12:56 AM, Simon Yarde wrote: > What's going on? I expected the second and third send operation to return > 0 bytes sent, because the send buffer can only hold 1 byte. If the underlying write operation returns EWOULDBLOCK then the "send" function calls into the GHC IO man

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

2013-09-03 Thread Brandon Allbery
On Tue, Sep 3, 2013 at 6:56 PM, Simon Yarde wrote: > I've found that setting the send buffer size causes send to truncate the > ByteString to the buffer size, but that successive sends continue to > succeed when the buffer should be full. > I see no actual flow control here. That the receiver is