Skip to content

Instantly share code, notes, and snippets.

@donsbot
Created April 5, 2022 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donsbot/106a83b8d7485bef312917cc714cb913 to your computer and use it in GitHub Desktop.
Save donsbot/106a83b8d7485bef312917cc714cb913 to your computer and use it in GitHub Desktop.
module Main where
import Control.Exception
import Control.Concurrent
import Control.Concurrent.Async
import Network.Socket
import Common
main :: IO ()
main = bracketOnError
(open "0.0.0.0" "1024")
close
(loop 2)
loop :: Int -> Socket -> IO ()
loop n server = go n
where
go 0 = return ()
go !n = concurrently takeClients (go (n-1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment