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

Patrick LeBoutillier patrick.leboutillier at gmail.com
Mon Jun 7 18:09:28 EDT 2010


Hi,

Could this have something to do with SO_REUSEADDR?
This could be the case if you interrupt the server while some clients
are connected to it.

If so, I think the Haskell way to set this is: setSocketOption socket
ReuseAddr 1

Patrick



On Fri, Jun 4, 2010 at 2:59 PM, aditya siram <aditya.siram at gmail.com> wrote:
> 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?
> -deech
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada


More information about the Beginners mailing list