[Haskell] setSocketOption unusable?

John Goerzen jgoerzen at complete.org
Wed Oct 12 16:01:16 EDT 2005


I'm wanting to set the SO_RCVTIMEO and SO_SNDTIMEO options on a socket
from Haskell.  socket(7) say that these take a struct timeval ad a
parameter.  (Other options, such as SO_LONGER, also could have this
problem.)

In Haskell, we see:

setSocketOption :: Socket -> SocketOption -> Int -> IO ()

Now, there are SocketOption constructors (RecvTimeOut and SendTimeOut)
for what I want.  But there is no way to give it a proper timeval (and
yes, I checked the source.)

setSocketOption definately wants an Int, and is passing the length of
the Int to setsockopt(2) as well, so it appears to me that there is
absolutely no way to correctly specify SO_RCVTIMEO or SO_SNDTIMEO
through Haskell's socket layer.

Is that correct?

If so, how can we fix it?

-- John




More information about the Haskell mailing list