给出以下代码
(@<) :: Port -> IO Socket
(@<) p = do -- listen
#if !defined(IPV4ONLY)
s <- socket AF_INET6 Stream 0 =>> opt
setSocketOption s IPv6Only 0 // try_
bindSocket s $ SockAddrInet6 p 0 iN6ADDR_ANY 0
#else
s <- socket AF_INET Stream 0 =>> opt -- Windows XP does not have
setSocketOption s $ SockAddrInet p iNADDR_ANY -- a dual-stack sockets API
#endif
listen s maxListenQueue
print $ Service Listen p
return s
where opt s = mapM_ (\o -> setSocketOption s o 1) [ ReuseAddr, KeepAlive ]
配置(cabal配置)时间最简洁/最短的方式是什么:
IPV4ONLY
醇>
首选的仅限Cabal的方法。我认为检查太小,无法创建完整的配置脚本