[Haskell-cafe] Socket not released

Jonathan Geddes geddes.jonathan at gmail.com
Mon Aug 9 09:31:22 EDT 2010


> You need to close the parent's socket in the child fork, as well as
> the parent - if it's inherited by the child, it's held open there,
> even if the parent closes it.

Thanks! That did the trick.

I did so by adding

>close_fds = True

to the CreateProcess record. However the documentation of
System.Process says that this only works on Windows if std_in,
std_out, and std_err are all set to Inherit. This is not the case in
my program so it will not work on any nodes that run on Windows. What
is the workaround for doing this kind of thing in Windows? Also since
the file descriptor of the socket appears to be inherited by the child
process, can I just start using it rather than closing it in both the
parent and child and then creating a new one?


More information about the Haskell-Cafe mailing list