[Haskell-beginners] Best way to stop listening on a port.

aditya siram aditya.siram at gmail.com
Fri Jun 4 14:59:22 EDT 2010

Hi all,
I've been writing some server code like the following:
Control.Exception.bracketOnError (listenOn port) sClose procRequests

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.

Is there a better way to correctly stop listening on a port?

More information about the Beginners mailing list