[Haskell-cafe] Socket not released

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Sat Aug 7 20:17:46 EDT 2010


-----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 also terminates.

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).  And the workaround is to set
SO_REUSEADDR before binding the port; in Haskell,

> setSocketOption socket ReuseAddr 1

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxd96oACgkQIn7hlCsL25WySACfVmlN/01XGy4LORpdi+N9ZC+x
Rd8An2ccUuh7XWdh0krnf70t+kqYolOM
=dbL9
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list