Are handles closed automatically when they fall out of scope?
jgoerzen at complete.org
Mon Oct 25 09:24:25 EDT 2004
On 2004-10-25, Simon Marlow <simonmar at microsoft.com> wrote:
> On 22 October 2004 21:58, Peter Simons wrote:
> On 24 October 2004 23:37, John Goerzen wrote:
>> * What happens when one Handle corresponding to a socket is closed,
>> but another isn't?
> You shouldn't have two Handles on the same socket. This is an unchecked
This does seem useful, though. I am actually doing this in my code and
it works. One Handle is opened ReadOnly, the other WriteOnly. That
way, I can use hGetContents on the reading side in my network code.
If I tried that with a single Handle opened ReadWrite, then I'd get
errors about it being closed whenever I'd try to write out some data.
I wasn't able to find any other good way around it.
More information about the Glasgow-haskell-users