haskell / network

Low-level networking interface
http://hackage.haskell.org/package/network
Other
325 stars 187 forks source link

Exception when setting `UserTimeout` with `setSocketOption` #571

Open pnlph opened 11 months ago

pnlph commented 11 months ago

While using the network-3.1.4.0 library in OSX 13.5.2, I encountered an exception when attempting to set the UserTimeout socket option using the setSocketOption function. Here's the relevant code snippet:

S.setSocketOption s S.UserTimeout 1000

And here's the exception message:

*** Exception: Network.Socket.setSockOpt: invalid argument (Invalid argument)

I am unsure if the exception is provoked by a limitation imposed by the operating system or the underlying network subsystem or something else. The error message lacks specificity which makes it difficult to diagnose the problem. Is it possible to deliver more concretion in the error message to help identify the root cause?

kazu-yamamoto commented 11 months ago

It seems to me that TCP_USER_TIMEOUT (UserTimeout) is specific to Linux.

More convenient error handling should be provided as discussed in #151.