[Haskell-beginners] Still wrestling with lazy IO

Raphael Päbst raphael.paebst at googlemail.com
Sun Jun 19 16:53:03 CEST 2011


I think, you're right. I read the ByteString from the handle using
hGetContents, which then waits for eof, which I don't send apparently.
Is there a way to do this explicitely?

Raf

On 6/19/11, Chaddaï Fouché <chaddai.fouche at gmail.com> wrote:
> On Sat, Jun 18, 2011 at 10:26 PM, Raphael Päbst
> <raphael.paebst at googlemail.com> wrote:
>> Mainly I'd say it's that I want to send the answer back via the same
>> handle. That's where the problem comes from, I suspect. Since it is
>> lazy IO, it only evaluates, once the handle gets closed from the
>> client side. And then it is too late to send something back. At least
>> that's how I understand it.
>>
>
> No it don't work like that, what's more probably happening is that
> your program is structured so that the answer can't be created until
> the "end" of the "request" is read and this "end" won't appear until
> eof has been received. You should make it explicit in your request
> that it is finished (send two empy lines at the end of the request for
> instance). If you don't manage to do that, show us your code so that
> we could point out your mistake.
>
> --
> JedaÏ
>



More information about the Beginners mailing list