Created
April 5, 2022 02:00
-
-
Save donsbot/106a83b8d7485bef312917cc714cb913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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