Hi, I'm trying to work on following code below (code is a copy from here). Problem is that when I close the server with ctrl+c and try to run it again I get: *** Exception: bind: resource busy (Address already in use).

In documentation of listenOn is written: NOTE: To avoid the "Address already in use" problems popped up several times on the GHC-Users mailing list we set the ReuseAddrsocket option on the listening socket. If you don't want this behaviour, please use the lower level listen instead. Please how can I fix this? (ghci version 7.6.3)

cheers m.

                                                      
import Network (listenOn, accept, PortID(..), Socket)   
import System.IO (hSetBuffering, hGetLine, hPutStrLn, BufferMode(..), Handle)                                                                        
import Control.Concurrent (forkIO)                                        
                                                                          
echoImpl :: Handle -> IO ()                                               
echoImpl client = do                                                      
  line <- hGetLine client                                                
  hPutStrLn client line                                                  
  echoImpl client                                                        
                                                                          
clientHandler :: Socket -> IO ()                                          
clientHandler sock = do                                                        
  (client, _, _) <- accept sock                                          
  hSetBuffering client NoBuffering                                       
  forkIO $ echoImpl client                                               
  clientHandler sock                                                     
                                                                          
felix :: IO ()                                                             
felix = do                                                       
   sock <- listenOn $ PortNumber 5002                                  
   putStrLn $ "Echo server started .."                                   
   clientHandler sock