gameServer/NetRoutines.hs
changeset 1917 c94045b70142
parent 1847 2178c0fc838c
child 1924 8f8fe856ce9d
equal deleted inserted replaced
1916:9c3d0e3df6bb 1917:c94045b70142
    10 import Control.Exception
    10 import Control.Exception
    11 import Data.Time
    11 import Data.Time
    12 -----------------------------
    12 -----------------------------
    13 import CoreTypes
    13 import CoreTypes
    14 import ClientIO
    14 import ClientIO
    15 
    15 import Utils
    16 sockAddr2String :: SockAddr -> IO String
       
    17 sockAddr2String (SockAddrInet _ hostAddr) = inet_ntoa hostAddr
       
    18 sockAddr2String (SockAddrInet6 _ _ (a, b, c, d) _) = return (foldr1 (\a b -> a ++ ":" ++ b) [show a, show b, show c, show d])
       
    19 
    16 
    20 acceptLoop :: Socket -> Chan CoreMessage -> Int -> IO ()
    17 acceptLoop :: Socket -> Chan CoreMessage -> Int -> IO ()
    21 acceptLoop servSock coreChan clientCounter = do
    18 acceptLoop servSock coreChan clientCounter = do
    22 	Control.Exception.handle
    19 	Control.Exception.handle
    23 		(\(_ :: Exception) -> putStrLn "exception on connect") $
    20 		(\(_ :: Exception) -> putStrLn "exception on connect") $