[Haskell-beginners] Best way to stop listening on a port.
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Mon Jun 7 19:34:15 EDT 2010
On Jun 4, 2010, at 14:59 , aditya siram wrote:
> Sometimes I run this server in GHCI and interrupt it with C-c. But
> when I try and rerun the server it tells me that the port is already
> bound meaning that sClose either doesn't get called or doesn't
> complete. Terminating the interpreter seems to work.
Most systems keep a port bound for a little while after the socket
bound to it exits, so that any stray packets still in flight for that
port will correctly be caught and responded to.
The usual workaround for this is to set the SO_REUSEADDR flag (which
is sO_REUSEADDR in the Haskell network library) so that you can bind
to it immediately instead of waiting for it to time out.
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20100607/87b07f04/PGP.bin
More information about the Beginners
mailing list