problems with ghc-5.02 Socket module (SunOS)

what am I doing wrong? it worked before ... this program module Main (main) where import IO import Socket main = do h <- connectTo "theopc.informatik.uni-leipzig.de" ( PortNumber $ 9999 ) putStrLn "connected" hClose h results in Fail: invalid argument Action: getSocketOption Reason: Invalid argument even though there IS a listener on the socket (other programs can connect to it). I have ghc-5.02 (binary package for SunOS) Any hints appreciated. how to find out what is invalid? -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --

In local.glasgow-haskell-users, you wrote:
Fail: invalid argument Action: getSocketOption Reason: Invalid argument
even though there IS a listener on the socket (other programs can connect to it).
I have ghc-5.02 (binary package for SunOS) Any hints appreciated. how to find out what is invalid?
'truss' says: ... connect(3, 0x500BB040, 16, 1) Err#150 EINPROGRESS poll(0xFFBEF500, 1, 134218) = 1 getsockopt(3, 65535, 4103, 0x500BB058, 0x500BB064, 1) Err#22 EINVAL Which is highly suspicious: getsockopt should never return EINVAL, so something is seriously wrong. The interface is int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); Notice the last parameter. Passing just "1" can't be right. The manpage mentions that For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by optval, and modified on return to indicate the actual size of the value returned. Use a 0 optval if no option value is to be supplied or returned. IMO it should be a pointer to a CInt containing "1". I'm currently getting ready a source-version of ghc to test this, but Slowlaris takes ages to build. I'd assume instead of 'alloca' it should be 'withObject'. Whatever. Maybe Simon M. finds a solution faster than me? -- Volker Stolz * stolz@i2.informatik.rwth-aachen.de * PGP + S/MIME
participants (2)
-
Johannes Waldmann
-
Volker Stolz