Socket library ghc 5.02.1

Sven Eric Panitz
Thu, 22 Nov 2001 15:00:34 +0100

	 From: Volker Stolz <>

	 In local.glasgow-haskell-users, you wrote:
	 >> main =
	 >>     do
	 >>     d <- connectTo "localhost" (PortNumber 80)
	 >>     hPutStr d "GET / HTTP/1.0\n\n"
	 >>     hFlush d
	 >>     c <- hGetContents d
	 >>     putStr c
	 > whereas on Linux I get the following error:
	 > *** Exception: failed
	 > Action: connect
	 > Reason: Unknown error 142731264

	 Please run the program with 'strace', e.g.
	 strace -o log ./a.out
	 and post the log when it fails.

	 Be aware that 'hGetContents' is broken on 5.02.1 if you use it
	 extensively (the GC will close already-reused fds and cause
	 your program to crash!), the patch was recently postet to -bugs
	 by Simon Marlow and works. OTOH, this is not the bug you're seeing.

As I just figured out, reported error above only occurs within ghci.
Otherwise Sockets seem to work on ghc 5.02.1 for Linux.

Sven Eric