[Haskell-beginners] A question about network programming
shaleh at speakeasy.net
Wed Jun 8 17:00:18 CEST 2011
Note they set the buffering to line buffered. This way you get data in line based chunks instead of all at once.
You could replace the sock IO with strip and see the difference interactively.
On Jun 8, 2011, at 6:17, Raphael Päbst <raphael.paebst at googlemail.com> wrote:
> Hey, that's what I did, pretty much.
> I had to inflict some changes on the server though.
> I'll play around with it some more and see what happens.
> On 6/8/11, aditya siram <aditya.siram at gmail.com> wrote:
>> Hi Raf,
>> I found that following the template for servers in the Network
>> Programming chapter  of Real World Haskell is the best way to go.
>> Scroll down to the "TCP Syslog Server" section for the relevant
>>  http://book.realworldhaskell.org/read/sockets-and-syslog.html
>> On Wed, Jun 8, 2011 at 6:29 AM, Raphael Päbst
>> <raphael.paebst at googlemail.com> wrote:
>>> Hey all!
>>> This is probably a question that shows my incompetence more than
>>> anything else, but I'm stuck with some TCP programming.
>>> I have some code that looks like this:
>>> hdl <- open TCP connection
>>> message <- hGetContents hdl
>>> answer <- do stuff with message
>>> hPut hdl answer
>>> hClose hdl
>>> My problem is that the stuff that gets done with message happens, but
>>> only after I close the connection rom the client's side and then of
>>> course it is too late to get the answer out of said connection.
>>> What am I doing wrong?
>>> Many Thanks
>>> Beginners mailing list
>>> Beginners at haskell.org
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners