
Jules Bean
Sebastiaan Visser wrote:
On Jun 16, 2008, at 2:58 PM, Jules Bean wrote:
Sebastiaan Visser wrote:
Does anyone know a pattern in which I can do this easily?
Don't use hGetContents on a socket. That's asking for trouble.
Can you please explain why?
Because it's a broken abstraction.
It's only correct if all you will ever do is read all the data into one String and don't care about it after that.
In my experience this is almost never true of sockets : there is always protocol overhead, handshaking, and the "next request".
It works for HTTP, as all responses MUST be in the same order as the requests. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited.