title: Exception: connect: does not exist (Connection refused) when trying to connect to TCP socket in Haskell
body: <h3>Context</h3>
  
  <p>I was following the <a href="http://book.realworldhaskell.org/read/sockets-and-syslog.html" rel="noreferrer">tutorial on writing a TCP server last week in Real World Haskell</a>. Everything went well and I had the final version of it working and was able to send messages between the TCP client and server.</p>
  
  <p>Then, I wanted to write my own TCP server for a small TicTacToe game that I coded. I started out writing the server and client and played around with it a bit, it worked so far that the server was able to accept connections, but there was no real interaction yet.</p>
  
  <p>Now it gets a bit awkward, because after I turned my Mac off and tried to reboot it again, it wouldn't boot any more. I fiddled around all Friday to do a backup from Single User Mode and reinstalled Mac OS. After a successful reinstallation, all my data was still there, so I didn't need the backup after all. </p>
  
  <p>Anyway, today I am turning back to my TicTacToe-server but it doesn't work any more. Or, at least the client can't connect to it any more. </p>
  
  <h3>TL;DR</h3>
  
  <p>I wrote a TCP server for a TicTacToe game inspired by the <a href="http://book.realworldhaskell.org/read/sockets-and-syslog.html" rel="noreferrer">tutorial in Real World Haskell</a> but am getting a <code>*** Exception: connect: does not exist (Connection refused)</code> error when trying to connect to the server. The same happens with the vanilla code from the mentioned tutorial. </p>
  
  <p>Note that I can still connect to the servers using <code>telnet</code>. I'm pretty sure the issue isn't with the code but rather on system level as the same code was working before I had the trouble with my machine (see above) and I am still using the identical code from the tutorial in RWH.   </p>