listen/bind socket problem in GHC 5.04

paul@theV.net paul@theV.net
Tue, 20 Aug 2002 14:39:04 +0800


I understand that GHC 5.04 has reoganized the network modules, 
but somehow my code broke over GHC 5.04... 

prepareSocket addr port = do
    s <- socket AF_INET Stream 6
    setSocketOption s ReuseAddr 1
    let port' = PortNum port
    addr' <- case addr of
        Just str -> inet_addr str >>= (\x -> return (SockAddrInet port' x))
        Nothing  -> return (SockAddrInet port' iNADDR_ANY)
    bindSocket s addr'
    listen s 2
    return s

A call to (preapreSocket Nothing 5002) is successful without error, but
netstat -l shows nothing under port 5002. What could possible go wrong
here? It used to work fine with GHC 5.02.

Regards,
.paul.