equal
deleted
inserted
replaced
21 emulateSession sock s = do |
21 emulateSession sock s = do |
22 mapM_ (\x -> hPutStrLn sock x >> hFlush sock >> randomRIO (50000::Int, 90000) >>= threadDelay) s |
22 mapM_ (\x -> hPutStrLn sock x >> hFlush sock >> randomRIO (50000::Int, 90000) >>= threadDelay) s |
23 hFlush sock |
23 hFlush sock |
24 threadDelay 225000 |
24 threadDelay 225000 |
25 |
25 |
26 testing = Control.Exception.handle (\e -> putStrLn $ show e) $ do |
26 testing = Control.Exception.handle print $ do |
27 putStrLn "Start" |
27 putStrLn "Start" |
28 sock <- connectTo "127.0.0.1" (PortNumber 46631) |
28 sock <- connectTo "127.0.0.1" (PortNumber 46631) |
29 |
29 |
30 num1 <- randomRIO (70000::Int, 70100) |
30 num1 <- randomRIO (70000::Int, 70100) |
31 num2 <- randomRIO (0::Int, 2) |
31 num2 <- randomRIO (0::Int, 2) |
32 num3 <- randomRIO (0::Int, 5) |
32 num3 <- randomRIO (0::Int, 5) |
33 let nick1 = show $ num1 |
33 let nick1 = show num1 |
34 let room1 = show $ num2 |
34 let room1 = show num2 |
35 case num2 of |
35 case num2 of |
36 0 -> emulateSession sock $ session1 nick1 room1 |
36 0 -> emulateSession sock $ session1 nick1 room1 |
37 1 -> emulateSession sock $ session2 nick1 room1 |
37 1 -> emulateSession sock $ session2 nick1 room1 |
38 2 -> emulateSession sock $ session3 nick1 room1 |
38 2 -> emulateSession sock $ session3 nick1 room1 |
39 hClose sock |
39 hClose sock |