[5.01] Runtime error in SocketPrim?!

Volker Stolz vs at foldr.org
Thu Jun 7 10:06:40 EDT 2001


Suddenly my program which would work fine in 4.08.2 & 5.00 throws
a pattern-match failure in SocketPrim/228 when compiled using 5.01.
There is the test for AF_INET/AF_UNIX. When catching this in an
"otherwise"-rule and printing the passed value, it is 7368, just for
the record. Is someone feeling guilty of perhaps having broken things?

Below the probably offending code I use.
The reason for reimplementing "listen" is that I can specify the interface
to bind to.

> listenOn :: Maybe String -- Interface (x.x.x.x)
>	  -> PortID      -- Port Identifier
>         -> IO Socket.Socket   -- Connected Socket
>
> listenOn iface (PortNumber port) = do
>    proto <- BSD.getProtocolNumber "tcp"
>    sock  <- SocketPrim.socket SocketPrim.AF_INET SocketPrim.Stream proto
>    SocketPrim.setSocketOption sock SocketPrim.ReuseAddr 1
>    i <- case iface of
>	    Nothing -> return SocketPrim.iNADDR_ANY
>	    Just s  -> do SocketPrim.inet_addr s
>    SocketPrim.bindSocket sock (SocketPrim.SockAddrInet port i)
>    SocketPrim.listen sock SocketPrim.maxListenQueue
>    return sock
-- 
Abstrakte Syntaxträume.
Volker Stolz * stolz at i2.informatik.rwth-aachen.de * PGP + S/MIME




More information about the Glasgow-haskell-bugs mailing list