
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@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH