[Haskell-cafe] bus error trying to use Network

Marcelo Sousa dipython at gmail.com
Fri Dec 17 08:01:46 CET 2010


I'm getting a bus error with Network library on my Mac OS X 10.6.5.
I have ghc 6.12.3, network 2.3.

As an example:
main = withSocketsDo $ 
          do sock <- listenOn $ PortNumber 4244
             (handle,host,port) <- accept sock
             hPutStr handle "Hi!"
             sClose sock

Any idea of what the problem could be?
If I use the Network.Socket library it works fine:

main = withSocketsDo $
         do sock <- socket AF_INET Stream 0
            setSocketOption sock ReuseAddr 1
            bindSocket sock (SockAddrInet 4244 iNADDR_ANY)
            listen sock 1
            (csock,_) <- accept sock
            send csock "Hi!\n"
            sClose csock
            sClose sock

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101217/7f485749/attachment.htm>

More information about the Haskell-Cafe mailing list