Re: [Haskell-cafe] Socket not released

2010-08-09 Thread Jonathan Geddes
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

Re: [Haskell-cafe] Socket not released

2010-08-09 Thread Donn Cave
Quoth Jonathan Geddes geddes.jonat...@gmail.com, 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

Re: [Haskell-cafe] Socket not released

2010-08-09 Thread Jonathan Geddes
Only a guess, but I predict that it will work for your purposes, since you're not concerned about what happens to std_in et al. I actually am concerned about what happens to std_in. The parent process serializes a bit of state and passes it to the child via the child's std_in. There's probably

[Haskell-cafe] Socket not released

2010-08-07 Thread Jonathan Geddes
Cafe, I'm writing a network application that uses static configuration a la xmonad and yi. When the app receives a certain command it recompiles its source, closes the socket it is using and runs its newly compiled predecessor as a new process. The problem I'm having is that the port that the

Re: [Haskell-cafe] Socket not released

2010-08-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/7/10 20:06 , Jonathan Geddes wrote: The problem I'm having is that the port that the parent process was using is not available to the child process. Even though the parent process has terminated, the port is unusable until the child process

Re: [Haskell-cafe] Socket not released

2010-08-07 Thread Jonathan Geddes
Thank you for your response Are you certain of this part?  The usual problem with this kind of program is that the system holds the socket open for a minute or so in case there are any packets in flight for the connection (the lower level network protocols not being 100% reliable). I'm not

Re: [Haskell-cafe] Socket not released

2010-08-07 Thread Donn Cave
Quoth Jonathan Geddes geddes.jonat...@gmail.com, ... but here's what I'm seeing. The process tries n times to acquire the socket, pausing for a second or so between attempts. While running a child process I will run a fresh process so that the two processes are competing for the socket, but